Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion boards/nordic/thingy53/thingy53_nrf5340_cpunet.dts
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
4 changes: 4 additions & 0 deletions drivers/wifi/nrfwifi/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
2 changes: 2 additions & 0 deletions drivers/wifi/nrfwifi/inc/wpa_supp_if.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
91 changes: 38 additions & 53 deletions drivers/wifi/nrfwifi/src/fmac_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -320,92 +320,75 @@
k_mutex_lock(&reg_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;

status = nrf_wifi_fmac_set_reg(fmac_dev_ctx, &reg_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, &reg_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__);

Check notice on line 367 in drivers/wifi/nrfwifi/src/fmac_main.c

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

You may want to run clang-format on this change

drivers/wifi/nrfwifi/src/fmac_main.c:367 - if (!reg_domain->chan_info) { + if (!reg_domain->chan_info) {
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, &reg_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(&reg_lock);
return ret;
}
Expand Down Expand Up @@ -850,7 +833,7 @@
.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
Expand Down Expand Up @@ -883,6 +866,8 @@
.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,
Expand Down
8 changes: 4 additions & 4 deletions drivers/wifi/nrfwifi/src/qspi/src/qspi_if.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,20 +85,20 @@
* 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
/* If anomaly 159 is to be prevented, only /1 divider can be used. */
#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))

Check notice on line 97 in drivers/wifi/nrfwifi/src/qspi/src/qspi_if.c

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

You may want to run clang-format on this change

drivers/wifi/nrfwifi/src/qspi/src/qspi_if.c:97 -#define INST_0_SCK_CFG (DIV_ROUND_UP(NRF_QSPI_BASE_CLOCK_FREQ, \ - QSPI_IF_DEVICE_FREQUENCY) - 1) +#define INST_0_SCK_CFG (DIV_ROUND_UP(NRF_QSPI_BASE_CLOCK_FREQ, QSPI_IF_DEVICE_FREQUENCY) - 1)
/* 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
Expand Down
73 changes: 73 additions & 0 deletions drivers/wifi/nrfwifi/src/wpa_supp_if.c
Original file line number Diff line number Diff line change
Expand Up @@ -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, &reg_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, &reg_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,
Expand Down
2 changes: 1 addition & 1 deletion modules/hostap/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
5 changes: 1 addition & 4 deletions modules/hostap/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion west.yml
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ manifest:
groups:
- hal
- name: hal_nordic
revision: c1c448df1b751c1c03229a447a2216f29e6aaf99
revision: 0a753f99ea4899cfbb56e29ae40b4ded95a3ab77
path: modules/hal/nordic
groups:
- hal
Expand Down
Loading