diff --git a/boards/nordic/thingy53/thingy53_nrf5340_cpunet.dts b/boards/nordic/thingy53/thingy53_nrf5340_cpunet.dts index aa4d4df909c..3003d4924ce 100644 --- a/boards/nordic/thingy53/thingy53_nrf5340_cpunet.dts +++ b/boards/nordic/thingy53/thingy53_nrf5340_cpunet.dts @@ -72,7 +72,9 @@ #gpio-cells = <2>; gpio-map-mask = <0xffffffff 0xffffffc0>; gpio-map-pass-thru = <0 0x3f>; - gpio-map = <8 0 &gpio0 5 0>, /* P8, P0.05/AIN1 */ + gpio-map = <5 0 &gpio1 1 0>, /* P5, P1.01/GRANT */ + <6 0 &gpio1 0 0>, /* P6, P1.00/REQ */ + <8 0 &gpio0 5 0>, /* P8, P0.05/AIN1 */ <9 0 &gpio0 4 0>, /* P9, P0.04/AIN0 */ <15 0 &gpio0 8 0>, /* P15, P0.08/TRACEDATA3 */ <16 0 &gpio0 9 0>, /* P16, P0.09/TRACEDATA2 */ diff --git a/drivers/wifi/nrfwifi/CMakeLists.txt b/drivers/wifi/nrfwifi/CMakeLists.txt index 026363083ac..c274809f0e1 100644 --- a/drivers/wifi/nrfwifi/CMakeLists.txt +++ b/drivers/wifi/nrfwifi/CMakeLists.txt @@ -301,6 +301,10 @@ zephyr_compile_definitions_ifdef(CONFIG_NRF_WIFI_FEAT_KEEPALIVE -DNRF_WIFI_KEEPALIVE_PERIOD_S=${CONFIG_NRF_WIFI_KEEPALIVE_PERIOD_S} ) +zephyr_compile_definitions_ifdef(CONFIG_WIFI_MGMT_RAW_SCAN_RESULTS + -DWIFI_MGMT_RAW_SCAN_RESULTS=${CONFIG_WIFI_MGMT_RAW_SCAN_RESULTS} +) + zephyr_compile_definitions( -DNRF70_RX_NUM_BUFS=${CONFIG_NRF70_RX_NUM_BUFS} -DNRF70_MAX_TX_TOKENS=${CONFIG_NRF70_MAX_TX_TOKENS} diff --git a/drivers/wifi/nrfwifi/inc/wpa_supp_if.h b/drivers/wifi/nrfwifi/inc/wpa_supp_if.h index 06a13261a70..c543644e312 100644 --- a/drivers/wifi/nrfwifi/inc/wpa_supp_if.h +++ b/drivers/wifi/nrfwifi/inc/wpa_supp_if.h @@ -123,6 +123,8 @@ int nrf_wifi_supp_get_conn_info(void *if_priv, struct wpa_conn_info *info); void nrf_wifi_supp_event_proc_get_conn_info(void *os_vif_ctx, struct nrf_wifi_umac_event_conn_info *info, unsigned int event_len); +int nrf_wifi_supp_set_country(void *if_priv, const char *alpha2); +int nrf_wifi_supp_get_country(void *if_priv, char *alpha2); #endif /* CONFIG_NRF70_STA_MODE */ #ifdef CONFIG_NRF70_AP_MODE diff --git a/drivers/wifi/nrfwifi/src/fmac_main.c b/drivers/wifi/nrfwifi/src/fmac_main.c index f2f7ba41340..470be6c8055 100644 --- a/drivers/wifi/nrfwifi/src/fmac_main.c +++ b/drivers/wifi/nrfwifi/src/fmac_main.c @@ -320,51 +320,31 @@ int nrf_wifi_reg_domain(const struct device *dev, struct wifi_reg_domain *reg_do k_mutex_lock(®_lock, K_FOREVER); if (!dev || !reg_domain) { - goto err; + goto out; } vif_ctx_zep = dev->data; if (!vif_ctx_zep) { LOG_ERR("%s: vif_ctx_zep is NULL", __func__); - goto err; + goto out; } rpu_ctx_zep = vif_ctx_zep->rpu_ctx_zep; if (!rpu_ctx_zep) { LOG_ERR("%s: rpu_ctx_zep is NULL", __func__); - goto err; + goto out; } fmac_dev_ctx = rpu_ctx_zep->rpu_ctx; if (!fmac_dev_ctx) { LOG_ERR("%s: fmac_dev_ctx is NULL", __func__); - goto err; + goto out; } +#ifdef CONFIG_NRF70_SCAN_ONLY if (reg_domain->oper == WIFI_MGMT_SET) { -#ifndef CONFIG_NRF70_RADIO_TEST -#ifdef CONFIG_NRF70_STA_MODE - /* Need to check if WPA supplicant is initialized or not. - * Must be checked when CONFIG_WIFI_NM_WPA_SUPPLICANT is enabled. - * Not applicable for RADIO_TEST or when - * CONFIG_WIFI_NM_WPA_SUPPLICANT is not enabled. - */ - /* It is possbile that during supplicant initialization driver may - * get the command. lock will try to ensure that supplicant - * initialization is complete. - */ - k_mutex_lock(&vif_ctx_zep->vif_lock, K_FOREVER); - if ((!vif_ctx_zep->supp_drv_if_ctx) || - (!wifi_nm_get_instance_iface(vif_ctx_zep->zep_net_if_ctx))) { - LOG_ERR("%s: WPA supplicant initialization not complete yet", __func__); - k_mutex_unlock(&vif_ctx_zep->vif_lock); - goto err; - } - k_mutex_unlock(&vif_ctx_zep->vif_lock); -#endif /* CONFIG_NRF70_STA_MODE */ -#endif /* !CONFIG_NRF70_RADIO_TEST */ memcpy(reg_domain_info.alpha2, reg_domain->country_code, WIFI_COUNTRY_CODE_LEN); reg_domain_info.force = reg_domain->force; @@ -372,40 +352,43 @@ int nrf_wifi_reg_domain(const struct device *dev, struct wifi_reg_domain *reg_do status = nrf_wifi_fmac_set_reg(fmac_dev_ctx, ®_domain_info); if (status != NRF_WIFI_STATUS_SUCCESS) { LOG_ERR("%s: Failed to set regulatory domain", __func__); - goto err; + goto out; } - } else if (reg_domain->oper == WIFI_MGMT_GET) { - if (!reg_domain->chan_info) { - LOG_ERR("%s: Invalid regulatory info (NULL)\n", __func__); - goto err; - } + goto out; + } +#endif + if (reg_domain->oper != WIFI_MGMT_GET) { + LOG_ERR("%s: Invalid operation: %d", __func__, reg_domain->oper); + goto out; + } - status = nrf_wifi_fmac_get_reg(fmac_dev_ctx, ®_domain_info); - if (status != NRF_WIFI_STATUS_SUCCESS) { - LOG_ERR("%s: Failed to get regulatory domain", __func__); - goto err; - } + if (!reg_domain->chan_info) { + LOG_ERR("%s: Invalid regulatory info (NULL)\n", __func__); + goto out; + } - memcpy(reg_domain->country_code, reg_domain_info.alpha2, WIFI_COUNTRY_CODE_LEN); - reg_domain->num_channels = reg_domain_info.reg_chan_count; - - for (chan_idx = 0; chan_idx < reg_domain_info.reg_chan_count; chan_idx++) { - chan_info = &(reg_domain->chan_info[chan_idx]); - reg_domain_chan_info = &(reg_domain_info.reg_chan_info[chan_idx]); - chan_info->center_frequency = reg_domain_chan_info->center_frequency; - chan_info->dfs = !!reg_domain_chan_info->dfs; - chan_info->max_power = reg_domain_chan_info->max_power; - chan_info->passive_only = !!reg_domain_chan_info->passive_channel; - chan_info->supported = !!reg_domain_chan_info->supported; - } - } else { - LOG_ERR("%s: Invalid operation: %d", __func__, reg_domain->oper); - goto err; + status = nrf_wifi_fmac_get_reg(fmac_dev_ctx, ®_domain_info); + if (status != NRF_WIFI_STATUS_SUCCESS) { + LOG_ERR("%s: Failed to get regulatory domain", __func__); + goto out; + } + + memcpy(reg_domain->country_code, reg_domain_info.alpha2, WIFI_COUNTRY_CODE_LEN); + reg_domain->num_channels = reg_domain_info.reg_chan_count; + + for (chan_idx = 0; chan_idx < reg_domain_info.reg_chan_count; chan_idx++) { + chan_info = &(reg_domain->chan_info[chan_idx]); + reg_domain_chan_info = &(reg_domain_info.reg_chan_info[chan_idx]); + chan_info->center_frequency = reg_domain_chan_info->center_frequency; + chan_info->dfs = !!reg_domain_chan_info->dfs; + chan_info->max_power = reg_domain_chan_info->max_power; + chan_info->passive_only = !!reg_domain_chan_info->passive_channel; + chan_info->supported = !!reg_domain_chan_info->supported; } ret = 0; -err: +out: k_mutex_unlock(®_lock); return ret; } @@ -850,7 +833,7 @@ static 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, -#endif /* CONFIG_NRF70_STA_MODE */ +#endif #ifdef CONFIG_NRF70_SYSTEM_WITH_RAW_MODES .mode = nrf_wifi_mode, #endif @@ -883,6 +866,8 @@ static struct zep_wpa_supp_dev_ops wpa_supp_ops = { .register_frame = nrf_wifi_supp_register_frame, .get_capa = nrf_wifi_supp_get_capa, .get_conn_info = nrf_wifi_supp_get_conn_info, + .set_country = nrf_wifi_supp_set_country, + .get_country = nrf_wifi_supp_get_country, #ifdef CONFIG_NRF70_AP_MODE .init_ap = nrf_wifi_wpa_supp_init_ap, .start_ap = nrf_wifi_wpa_supp_start_ap, diff --git a/drivers/wifi/nrfwifi/src/qspi/src/qspi_if.c b/drivers/wifi/nrfwifi/src/qspi/src/qspi_if.c index 26d9249248c..46c92def8f7 100644 --- a/drivers/wifi/nrfwifi/src/qspi/src/qspi_if.c +++ b/drivers/wifi/nrfwifi/src/qspi/src/qspi_if.c @@ -85,7 +85,7 @@ BUILD_ASSERT(QSPI_IF_DEVICE_FREQUENCY >= (NRF_QSPI_BASE_CLOCK_FREQ / 16), * PCLK192M frequency"), but after that operation is complete, the default * divider needs to be restored to avoid increased current consumption. */ -#if (INST_0_SCK_FREQUENCY >= NRF_QSPI_BASE_CLOCK_FREQ) +#if (QSPI_IF_DEVICE_FREQUENCY >= NRF_QSPI_BASE_CLOCK_FREQ) /* For requested SCK >= 96 MHz, use HFCLK192M / 1 / (2*1) = 96 MHz */ #define BASE_CLOCK_DIV NRF_CLOCK_HFCLK_DIV_1 #define INST_0_SCK_CFG NRF_QSPI_FREQ_DIV1 @@ -93,12 +93,12 @@ BUILD_ASSERT(QSPI_IF_DEVICE_FREQUENCY >= (NRF_QSPI_BASE_CLOCK_FREQ / 16), #elif NRF53_ERRATA_159_ENABLE_WORKAROUND #define BASE_CLOCK_DIV NRF_CLOCK_HFCLK_DIV_1 #define INST_0_SCK_CFG (DIV_ROUND_UP(NRF_QSPI_BASE_CLOCK_FREQ, \ - INST_0_SCK_FREQUENCY) - 1) -#elif (INST_0_SCK_FREQUENCY >= (NRF_QSPI_BASE_CLOCK_FREQ / 2)) + QSPI_IF_DEVICE_FREQUENCY) - 1) +#elif (QSPI_IF_DEVICE_FREQUENCY >= (NRF_QSPI_BASE_CLOCK_FREQ / 2)) /* For 96 MHz > SCK >= 48 MHz, use HFCLK192M / 2 / (2*1) = 48 MHz */ #define BASE_CLOCK_DIV NRF_CLOCK_HFCLK_DIV_2 #define INST_0_SCK_CFG NRF_QSPI_FREQ_DIV1 -#elif (INST_0_SCK_FREQUENCY >= (NRF_QSPI_BASE_CLOCK_FREQ / 3)) +#elif (QSPI_IF_DEVICE_FREQUENCY >= (NRF_QSPI_BASE_CLOCK_FREQ / 3)) /* For 48 MHz > SCK >= 32 MHz, use HFCLK192M / 1 / (2*3) = 32 MHz */ #define BASE_CLOCK_DIV NRF_CLOCK_HFCLK_DIV_1 #define INST_0_SCK_CFG NRF_QSPI_FREQ_DIV3 diff --git a/drivers/wifi/nrfwifi/src/wpa_supp_if.c b/drivers/wifi/nrfwifi/src/wpa_supp_if.c index b022c8d5af1..292c1b9117a 100644 --- a/drivers/wifi/nrfwifi/src/wpa_supp_if.c +++ b/drivers/wifi/nrfwifi/src/wpa_supp_if.c @@ -1861,6 +1861,79 @@ int nrf_wifi_supp_get_conn_info(void *if_priv, struct wpa_conn_info *info) return ret; } +int nrf_wifi_supp_set_country(void *if_priv, const char *alpha2) +{ + struct nrf_wifi_vif_ctx_zep *vif_ctx_zep = NULL; + struct nrf_wifi_ctx_zep *rpu_ctx_zep = NULL; + enum nrf_wifi_status status = NRF_WIFI_STATUS_FAIL; + struct nrf_wifi_fmac_reg_info reg_domain_info = {0}; + + if (!if_priv || !alpha2) { + LOG_ERR("%s: Invalid params", __func__); + return -1; + } + + vif_ctx_zep = if_priv; + rpu_ctx_zep = vif_ctx_zep->rpu_ctx_zep; + if (!rpu_ctx_zep) { + LOG_ERR("%s: rpu_ctx_zep is NULL", __func__); + return -1; + } + + k_mutex_lock(&vif_ctx_zep->vif_lock, K_FOREVER); + if (!rpu_ctx_zep->rpu_ctx) { + LOG_DBG("%s: RPU context not initialized", __func__); + goto out; + } + + memcpy(reg_domain_info.alpha2, alpha2, NRF_WIFI_COUNTRY_CODE_LEN); + + status = nrf_wifi_fmac_set_reg(rpu_ctx_zep->rpu_ctx, ®_domain_info); + if (status != NRF_WIFI_STATUS_SUCCESS) { + LOG_ERR("%s: nrf_wifi_fmac_set_reg failed", __func__); + goto out; + } +out: + k_mutex_unlock(&vif_ctx_zep->vif_lock); + return status; +} + +int nrf_wifi_supp_get_country(void *if_priv, char *alpha2) +{ + struct nrf_wifi_vif_ctx_zep *vif_ctx_zep = NULL; + struct nrf_wifi_ctx_zep *rpu_ctx_zep = NULL; + enum nrf_wifi_status status = NRF_WIFI_STATUS_FAIL; + struct nrf_wifi_fmac_reg_info reg_domain_info = {0}; + + if (!if_priv || !alpha2) { + LOG_ERR("%s: Invalid params", __func__); + return -1; + } + + vif_ctx_zep = if_priv; + rpu_ctx_zep = vif_ctx_zep->rpu_ctx_zep; + if (!rpu_ctx_zep) { + LOG_ERR("%s: rpu_ctx_zep is NULL", __func__); + return -1; + } + + k_mutex_lock(&vif_ctx_zep->vif_lock, K_FOREVER); + if (!rpu_ctx_zep->rpu_ctx) { + LOG_DBG("%s: RPU context not initialized", __func__); + goto out; + } + + status = nrf_wifi_fmac_get_reg(rpu_ctx_zep->rpu_ctx, ®_domain_info); + if (status != NRF_WIFI_STATUS_SUCCESS) { + LOG_ERR("%s: nrf_wifi_fmac_get_reg failed", __func__); + goto out; + } + + memcpy(alpha2, reg_domain_info.alpha2, NRF_WIFI_COUNTRY_CODE_LEN); +out: + k_mutex_unlock(&vif_ctx_zep->vif_lock); + return status; +} void nrf_wifi_supp_event_proc_get_conn_info(void *if_priv, struct nrf_wifi_umac_event_conn_info *info, diff --git a/modules/hostap/CMakeLists.txt b/modules/hostap/CMakeLists.txt index 1a97360b48e..7ad0d22bb6a 100644 --- a/modules/hostap/CMakeLists.txt +++ b/modules/hostap/CMakeLists.txt @@ -668,9 +668,9 @@ zephyr_library_sources( ${HOSTAP_SRC_BASE}/crypto/aes-internal-enc.c ${HOSTAP_SRC_BASE}/crypto/rc4.c ${HOSTAP_SRC_BASE}/crypto/crypto_mbedtls_alt.c - ${HOSTAP_SRC_BASE}/crypto/tls_mbedtls_alt.c ${HOSTAP_SRC_BASE}/crypto/sha256-kdf.c ${HOSTAP_BASE}/port/mbedtls/supp_psa_api.c + ${HOSTAP_SRC_BASE}/crypto/tls_none.c ) endif() diff --git a/modules/hostap/Kconfig b/modules/hostap/Kconfig index f6c75f1a46c..300a61e5cd6 100644 --- a/modules/hostap/Kconfig +++ b/modules/hostap/Kconfig @@ -257,12 +257,9 @@ config WIFI_NM_WPA_SUPPLICANT_CRYPTO_ALT_NCS_PSA select MBEDTLS select NRF_SECURITY select PSA_WANT_GENERATE_RANDOM - select MBEDTLS_TLS_LIBRARY select MBEDTLS_PK_C + select MBEDTLS_MD_C select MBEDTLS_PK_WRITE_C - select MBEDTLS_X509_LIBRARY - select MBEDTLS_X509_CRT_PARSE_C - select MBEDTLS_SSL_TLS_C select MBEDTLS_ENABLE_HEAP select MBEDTLS_PSA_CRYPTO_C select MBEDTLS_USE_PSA_CRYPTO diff --git a/west.yml b/west.yml index 1116a94ec3b..ccc137c1079 100644 --- a/west.yml +++ b/west.yml @@ -188,7 +188,7 @@ manifest: groups: - hal - name: hal_nordic - revision: c1c448df1b751c1c03229a447a2216f29e6aaf99 + revision: 0a753f99ea4899cfbb56e29ae40b4ded95a3ab77 path: modules/hal/nordic groups: - hal