diff --git a/CMakeLists.txt b/CMakeLists.txt index 6dd124b66..dde3652b0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17,3 +17,4 @@ else() endif() add_subdirectory(zephyr/src) +zephyr_include_directories_ifdef(CONFIG_NXP_88W8987 zephyr/blobs/SD8987) \ No newline at end of file diff --git a/mcux/middleware/wifi_nxp/CMakeLists.txt b/mcux/middleware/wifi_nxp/CMakeLists.txt index 3f3271b09..160590be3 100644 --- a/mcux/middleware/wifi_nxp/CMakeLists.txt +++ b/mcux/middleware/wifi_nxp/CMakeLists.txt @@ -24,120 +24,160 @@ zephyr_compile_definitions_ifdef(CONFIG_NXP_RW610 WIFI_BT_TX_PWR_LIMITS="wlan_txpwrlimit_cfg_WW_rw610.h" ) -zephyr_compile_definitions_ifdef(CONFIG_88W8987_AW_CM358_USD +zephyr_compile_definitions_ifdef(CONFIG_NXP_88W8987_AW_CM358_USD WIFI_BT_TX_PWR_LIMITS="wlan_txpwrlimit_cfg_WW.h" CONFIG_NXP_WIFI_ED_OFFSET_2G=0x09 CONFIG_NXP_WIFI_ED_OFFSET_5G=0x0C WIFI_BT_USE_USD_INTERFACE ) -zephyr_compile_definitions_ifdef(CONFIG_88W8987_AW_CM358MA_M2 +zephyr_compile_definitions_ifdef(CONFIG_NXP_88W8987_AW_CM358MA_M2 WIFI_BT_TX_PWR_LIMITS="wlan_txpwrlimit_cfg_WW.h" CONFIG_NXP_WIFI_ED_OFFSET_2G=0x09 CONFIG_NXP_WIFI_ED_OFFSET_5G=0x0C WIFI_BT_USE_M2_INTERFACE ) -zephyr_compile_definitions_ifdef(CONFIG_88W8987_MURATA_1ZM_USD +zephyr_compile_definitions_ifdef(CONFIG_NXP_88W8987_MURATA_1ZM_USD WIFI_BT_TX_PWR_LIMITS="wlan_txpwrlimit_cfg_murata_1ZM_WW.h" CONFIG_NXP_WIFI_ED_OFFSET_2G=0x06 CONFIG_NXP_WIFI_ED_OFFSET_5G=0x06 WIFI_BT_USE_USD_INTERFACE ) -zephyr_compile_definitions_ifdef(CONFIG_88W8987_MURATA_1ZM_M2 +zephyr_compile_definitions_ifdef(CONFIG_NXP_88W8987_MURATA_1ZM_M2 WIFI_BT_TX_PWR_LIMITS="wlan_txpwrlimit_cfg_murata_1ZM_WW.h" CONFIG_NXP_WIFI_ED_OFFSET_2G=0x06 CONFIG_NXP_WIFI_ED_OFFSET_5G=0x06 WIFI_BT_USE_M2_INTERFACE ) -zephyr_compile_definitions_ifdef(CONFIG_IW416_AW_AM457_USD +if(CONFIG_NXP_88W8987) +zephyr_include_directories( + wifi_bt_firmware/8987 +) + +zephyr_library_sources_ifdef(CONFIG_NXP_88W8987 + wifi_bt_firmware/8987/8987_cpu12.c +) +endif() + +if(CONFIG_NXP_IW416) +zephyr_include_directories( + wifi_bt_firmware/IW416 +) + +zephyr_library_sources_ifdef(CONFIG_NXP_IW416 + wifi_bt_firmware/IW416/IW416_cpu12.c +) +endif() + +if(CONFIG_NXP_88W8801) +zephyr_include_directories( + wifi_bt_firmware/8801 +) + +zephyr_library_sources_ifdef(CONFIG_NXP_88W8801 + wifi_bt_firmware/8801/8801_cpu1.c +) +endif() + +if(CONFIG_NXP_IW61X) +zephyr_include_directories( + wifi_bt_firmware/nw61x +) + +zephyr_library_sources_ifdef(CONFIG_NXP_IW61X + wifi_bt_firmware/nw61x/nw61x_cpu12_se.c +) +endif() + +zephyr_compile_definitions_ifdef(CONFIG_NXP_IW416_AW_AM457_USD WIFI_BT_TX_PWR_LIMITS="wlan_txpwrlimit_cfg_WW.h" CONFIG_NXP_WIFI_ED_OFFSET_2G=0x09 CONFIG_NXP_WIFI_ED_OFFSET_5G=0x0C WIFI_BT_USE_USD_INTERFACE ) -zephyr_compile_definitions_ifdef(CONFIG_IW416_AW_AM457MA_M2 +zephyr_compile_definitions_ifdef(CONFIG_NXP_IW416_AW_AM457MA_M2 WIFI_BT_TX_PWR_LIMITS="wlan_txpwrlimit_cfg_WW.h" CONFIG_NXP_WIFI_ED_OFFSET_2G=0x09 CONFIG_NXP_WIFI_ED_OFFSET_5G=0x0C WIFI_BT_USE_M2_INTERFACE ) -zephyr_compile_definitions_ifdef(CONFIG_IW416_AW_AM510_USD +zephyr_compile_definitions_ifdef(CONFIG_NXP_IW416_AW_AM510_USD WIFI_BT_TX_PWR_LIMITS="wlan_txpwrlimit_cfg_WW.h" CONFIG_NXP_WIFI_ED_OFFSET_2G=0x09 CONFIG_NXP_WIFI_ED_OFFSET_5G=0x0C WIFI_BT_USE_USD_INTERFACE ) -zephyr_compile_definitions_ifdef(CONFIG_IW416_AW_AM510MA_M2 +zephyr_compile_definitions_ifdef(CONFIG_NXP_IW416_AW_AM510MA_M2 WIFI_BT_TX_PWR_LIMITS="wlan_txpwrlimit_cfg_murata_1XK_WW.h" CONFIG_NXP_WIFI_ED_OFFSET_2G=0x09 CONFIG_NXP_WIFI_ED_OFFSET_5G=0x0C WIFI_BT_USE_M2_INTERFACE ) -zephyr_compile_definitions_ifdef(CONFIG_IW416_MURATA_1XK_USD +zephyr_compile_definitions_ifdef(CONFIG_NXP_IW416_MURATA_1XK_USD WIFI_BT_TX_PWR_LIMITS="wlan_txpwrlimit_cfg_murata_1XK_WW.h" CONFIG_NXP_WIFI_ED_OFFSET_2G=0x00 CONFIG_NXP_WIFI_ED_OFFSET_5G=0x0C WIFI_BT_USE_USD_INTERFACE ) -zephyr_compile_definitions_ifdef(CONFIG_IW416_MURATA_1XK_M2 +zephyr_compile_definitions_ifdef(CONFIG_NXP_IW416_MURATA_1XK_M2 WIFI_BT_TX_PWR_LIMITS="wlan_txpwrlimit_cfg_murata_1XK_WW.h" CONFIG_NXP_WIFI_ED_OFFSET_2G=0x00 CONFIG_NXP_WIFI_ED_OFFSET_5G=0x0C WIFI_BT_USE_M2_INTERFACE ) -zephyr_compile_definitions_ifdef(CONFIG_IW612_MURATA_2EL_USD +zephyr_compile_definitions_ifdef(CONFIG_NXP_IW612_MURATA_2EL_USD WIFI_BT_TX_PWR_LIMITS="wlan_txpwrlimit_cfg_murata_2EL_WW.h" CONFIG_NXP_WIFI_ED_OFFSET_2G=0x0A CONFIG_NXP_WIFI_ED_OFFSET_5G=0x0A WIFI_BT_USE_USD_INTERFACE ) -zephyr_compile_definitions_ifdef(CONFIG_IW612_MURATA_2EL_M2 +zephyr_compile_definitions_ifdef(CONFIG_NXP_IW612_MURATA_2EL_M2 WIFI_BT_TX_PWR_LIMITS="wlan_txpwrlimit_cfg_murata_2EL_WW.h" CONFIG_NXP_WIFI_ED_OFFSET_2G=0x0A CONFIG_NXP_WIFI_ED_OFFSET_5G=0x0A WIFI_BT_USE_M2_INTERFACE ) -zephyr_compile_definitions_ifdef(CONFIG_IW611_MURATA_2DL_USD +zephyr_compile_definitions_ifdef(CONFIG_NXP_IW611_MURATA_2DL_USD WIFI_BT_TX_PWR_LIMITS="wlan_txpwrlimit_cfg_murata_2EL_WW.h" CONFIG_NXP_WIFI_ED_OFFSET_2G=0x0A CONFIG_NXP_WIFI_ED_OFFSET_5G=0x0A WIFI_BT_USE_USD_INTERFACE ) -zephyr_compile_definitions_ifdef(CONFIG_IW611_MURATA_2DL_M2 +zephyr_compile_definitions_ifdef(CONFIG_NXP_IW611_MURATA_2DL_M2 WIFI_BT_TX_PWR_LIMITS="wlan_txpwrlimit_cfg_murata_2EL_WW.h" CONFIG_NXP_WIFI_ED_OFFSET_2G=0x0A CONFIG_NXP_WIFI_ED_OFFSET_5G=0x0A WIFI_BT_USE_M2_INTERFACE ) -zephyr_compile_definitions_ifdef(CONFIG_88W8801_AW_NM191_USD +zephyr_compile_definitions_ifdef(CONFIG_NXP_88W8801_AW_NM191_USD WIFI_BT_TX_PWR_LIMITS="wlan_txpwrlimit_cfg_WW.h" CONFIG_NXP_WIFI_ED_OFFSET_2G=0x1B ) -zephyr_compile_definitions_ifdef(CONFIG_88W8801_AW_NM191MA_M2 +zephyr_compile_definitions_ifdef(CONFIG_NXP_88W8801_AW_NM191MA_M2 WIFI_BT_TX_PWR_LIMITS="wlan_txpwrlimit_cfg_WW.h" CONFIG_NXP_WIFI_ED_OFFSET_2G=0x1B ) -zephyr_compile_definitions_ifdef(CONFIG_88W8801_MURATA_2DS_USD +zephyr_compile_definitions_ifdef(CONFIG_NXP_88W8801_MURATA_2DS_USD WIFI_BT_TX_PWR_LIMITS="wlan_txpwrlimit_cfg_murata_2DS_WW.h" CONFIG_NXP_WIFI_ED_OFFSET_2G=0x0E ) -zephyr_compile_definitions_ifdef(CONFIG_88W8801_MURATA_2DS_M2 +zephyr_compile_definitions_ifdef(CONFIG_NXP_88W8801_MURATA_2DS_M2 WIFI_BT_TX_PWR_LIMITS="wlan_txpwrlimit_cfg_murata_2DS_WW.h" CONFIG_NXP_WIFI_ED_OFFSET_2G=0x0E ) diff --git a/mcux/middleware/wifi_nxp/firmware_dnld/firmware_dnld.c b/mcux/middleware/wifi_nxp/firmware_dnld/firmware_dnld.c index 3665d54c8..424cee94c 100644 --- a/mcux/middleware/wifi_nxp/firmware_dnld/firmware_dnld.c +++ b/mcux/middleware/wifi_nxp/firmware_dnld/firmware_dnld.c @@ -248,8 +248,10 @@ int32_t firmware_download(const uint8_t *fw_start_addr, const size_t size, void if (ret != FWDNLD_STATUS_SUCCESS) { + fwdnld_io_d("firmware download failed"); return FWDNLD_STATUS_FAILURE; } + if (intf->intf_s.fwdnld_intf_check_ready) { return intf->intf_s.fwdnld_intf_check_ready(intf, NULL); diff --git a/mcux/middleware/wifi_nxp/sdio_nxp_abs/incl/mlan_sdio_api.h b/mcux/middleware/wifi_nxp/sdio_nxp_abs/incl/mlan_sdio_api.h index 27dfdd4bc..80095317b 100644 --- a/mcux/middleware/wifi_nxp/sdio_nxp_abs/incl/mlan_sdio_api.h +++ b/mcux/middleware/wifi_nxp/sdio_nxp_abs/incl/mlan_sdio_api.h @@ -45,6 +45,7 @@ #define sdio_d(...) #endif /* CONFIG_WIFI_SDIO_DEBUG */ +#ifndef __ZEPHYR__ #define SDIO_GO_IDLE_STATE ((uint8_t)0) #define SDIO_SET_REL_ADDR ((uint8_t)3) #define SDIO_SDIO_SEN_OP_COND ((uint8_t)5) @@ -54,6 +55,7 @@ /* Depends on DMA_BUFSZ */ #define DMA_BOUNDARY_SIZE (512 * 1024) +#endif /** Read Card Register * diff --git a/mcux/middleware/wifi_nxp/sdio_nxp_abs/mlan_sdio.c b/mcux/middleware/wifi_nxp/sdio_nxp_abs/mlan_sdio.c index e3cb7c440..d7e787b8d 100644 --- a/mcux/middleware/wifi_nxp/sdio_nxp_abs/mlan_sdio.c +++ b/mcux/middleware/wifi_nxp/sdio_nxp_abs/mlan_sdio.c @@ -7,14 +7,16 @@ * SPDX-License-Identifier: BSD-3-Clause * */ -#include -#include -#include + #include #include +#include +#include #include +#include + #define SDIO_CMD_TIMEOUT 2000 const struct device *sdhc_dev = DEVICE_DT_GET(DT_BUS(DT_COMPAT_GET_ANY_STATUS_OKAY(nxp_wifi))); @@ -87,9 +89,96 @@ void sdio_enable_interrupt(void) return; } +struct wifi_gpio_config +{ +#if DT_NODE_HAS_PROP(DT_NODELABEL(wifi), pdn_gpios) + const struct gpio_dt_spec pdn; +#endif +#if DT_NODE_HAS_PROP(DT_NODELABEL(wifi), wl_rst_gpios) + const struct gpio_dt_spec wl_rst; +#endif +#if DT_NODE_HAS_PROP(DT_NODELABEL(wifi), bt_rst_gpios) + const struct gpio_dt_spec bt_rst; +#endif +}; + +static const struct wifi_gpio_config wifi_gpio = { +#if DT_NODE_HAS_PROP(DT_NODELABEL(wifi), pdn_gpios) + .pdn = GPIO_DT_SPEC_GET(DT_NODELABEL(wifi), pdn_gpios), +#endif +#if DT_NODE_HAS_PROP(DT_NODELABEL(wifi), wl_rst_gpios) + .wl_rst = GPIO_DT_SPEC_GET(DT_NODELABEL(wifi), wl_rst_gpios), +#endif +#if DT_NODE_HAS_PROP(DT_NODELABEL(wifi), bt_rst_gpios) + .bt_rst = GPIO_DT_SPEC_GET(DT_NODELABEL(wifi), bt_rst_gpios), +#endif +}; + +void BOARD_WIFI_BT_Enable(bool enable) +{ + if (enable) + { +#if DT_NODE_HAS_PROP(DT_NODELABEL(wifi), pdn_gpios) + gpio_pin_set_dt(&wifi_gpio.pdn, 1); + k_msleep(100); +#endif + +#if DT_NODE_HAS_PROP(DT_NODELABEL(wifi), wl_rst_gpios) + gpio_pin_set_dt(&wifi_gpio.wl_rst, 1); +#endif + +#if DT_NODE_HAS_PROP(DT_NODELABEL(wifi), bt_rst_gpios) + gpio_pin_set_dt(&wifi_gpio.bt_rst, 1); +#endif + + k_msleep(100); + } + else + { +#if DT_NODE_HAS_PROP(DT_NODELABEL(wifi), wl_rst_gpios) + gpio_pin_set_dt(&wifi_gpio.wl_rst, 0); +#endif + +#if DT_NODE_HAS_PROP(DT_NODELABEL(wifi), bt_rst_gpios) + gpio_pin_set_dt(&wifi_gpio.bt_rst, 0); +#endif + + k_msleep(10); + +#if DT_NODE_HAS_PROP(DT_NODELABEL(wifi), pdn_gpios) + gpio_pin_set_dt(&wifi_gpio.pdn, 0); +#endif + + k_msleep(100); + } +} + static void sdio_controller_init(void) { (void)memset(&wm_g_sd, 0, sizeof(struct sd_card)); + +#if DT_NODE_HAS_PROP(DT_NODELABEL(wifi), wl_rst_gpios) + if (gpio_pin_configure_dt(&wifi_gpio.wl_rst, GPIO_OUTPUT) < 0) + { + sdio_e("Failed to configure WiFi reset pin"); + } +#endif + +#if DT_NODE_HAS_PROP(DT_NODELABEL(wifi), pdn_gpios) + if (gpio_pin_configure_dt(&wifi_gpio.pdn, GPIO_OUTPUT) < 0) + { + sdio_e("Failed to configure power down pin"); + } +#endif + +#if DT_NODE_HAS_PROP(DT_NODELABEL(wifi), bt_rst_gpios) + if (gpio_pin_configure_dt(&wifi_gpio.bt_rst, GPIO_OUTPUT) < 0) + { + sdio_e("Failed to configure BT reset pin"); + } +#endif + + BOARD_WIFI_BT_Enable(false); } static int sdio_card_init(void) @@ -97,6 +186,8 @@ static int sdio_card_init(void) int ret = WM_SUCCESS; uint32_t resp; + BOARD_WIFI_BT_Enable(true); + if (!device_is_ready(sdhc_dev)) { sdio_e("SD controller not ready"); diff --git a/mcux/middleware/wifi_nxp/wifidriver/mlan_glue.c b/mcux/middleware/wifi_nxp/wifidriver/mlan_glue.c index 335263db7..24a9243fb 100644 --- a/mcux/middleware/wifi_nxp/wifidriver/mlan_glue.c +++ b/mcux/middleware/wifi_nxp/wifidriver/mlan_glue.c @@ -3405,24 +3405,6 @@ int wifi_process_cmd_response(HostCmd_DS_COMMAND *resp) rv = wlan_ops_sta_process_cmdresp(pmpriv, command, resp, NULL); } break; -#ifdef SD8801 - case HostCmd_CMD_ROBUST_COEX: - { - const HostCmd_DS_ExtBLECoex_Config_t *coex = &resp->params.ext_ble_coex_cfg; - if (coex->action == HostCmd_ACT_GEN_GET) - { - if (wm_wifi.cmd_resp_priv != NULL) - { - wifi_ext_coex_stats_t *stats = (wifi_ext_coex_stats_t *)wm_wifi.cmd_resp_priv; - stats->ext_radio_req_count = coex->coex_cfg_data.EXT_RADIO_REQ_count; - stats->ext_radio_pri_count = coex->coex_cfg_data.EXT_RADIO_PRI_count; - stats->wlan_grant_count = coex->coex_cfg_data.WLAN_GRANT_count; - } - } - wm_wifi.cmd_resp_status = WM_SUCCESS; - } - break; -#endif #if CONFIG_11N case HostCmd_CMD_11N_CFG: rv = wlan_ret_11n_cfg(pmpriv, resp, NULL); @@ -4697,14 +4679,33 @@ int wifi_process_cmd_response(HostCmd_DS_COMMAND *resp) wm_wifi.cmd_resp_status = -WM_FAIL; break; #endif -#if (CONFIG_COEX_DUTY_CYCLE) || (CONFIG_EXTERNAL_COEX_PTA) || (CONFIG_IMD3_CFG) case HostCmd_CMD_ROBUST_COEX: + { + +#ifdef SD8801 + const HostCmd_DS_ExtBLECoex_Config_t *coex = &resp->params.ext_ble_coex_cfg; + if (coex->action == HostCmd_ACT_GEN_GET) + { + if (wm_wifi.cmd_resp_priv != NULL) + { + wifi_ext_coex_stats_t *stats = (wifi_ext_coex_stats_t *)wm_wifi.cmd_resp_priv; + stats->ext_radio_req_count = coex->coex_cfg_data.EXT_RADIO_REQ_count; + stats->ext_radio_pri_count = coex->coex_cfg_data.EXT_RADIO_PRI_count; + stats->wlan_grant_count = coex->coex_cfg_data.WLAN_GRANT_count; + } + } + wm_wifi.cmd_resp_status = WM_SUCCESS; +#endif + +#if (CONFIG_COEX_DUTY_CYCLE) || (CONFIG_EXTERNAL_COEX_PTA) || (CONFIG_IMD3_CFG) if (resp->result == HostCmd_RESULT_OK) wm_wifi.cmd_resp_status = WM_SUCCESS; else wm_wifi.cmd_resp_status = -WM_FAIL; - break; #endif + } + break; + #if (CONFIG_WIFI_IND_RESET) && (CONFIG_WIFI_IND_DNLD) case HostCmd_CMD_INDEPENDENT_RESET_CFG: { diff --git a/mcux/middleware/wifi_nxp/wifidriver/wifi-sdio.c b/mcux/middleware/wifi_nxp/wifidriver/wifi-sdio.c index fa304634c..d9f1665f6 100644 --- a/mcux/middleware/wifi_nxp/wifidriver/wifi-sdio.c +++ b/mcux/middleware/wifi_nxp/wifidriver/wifi-sdio.c @@ -233,6 +233,7 @@ static void wifi_sdio_wait_for_cmdresp() { /* assert as command flow cannot work anymore */ assert(0); + wifi_e("wifi_sdio_wait_for_cmdresp failed"); } } @@ -654,7 +655,7 @@ static mlan_status wlan_decode_rx_packet(t_u8 *pmbuf, t_u32 upld_type) } else #endif /* CONFIG_P2P */ - if ((fw_init_cfg == 0U) && (bus.event_queue != NULL)) + if ((fw_init_cfg == 0U) && (bus.event_queue != NULL)) { if (upld_type == MLAN_TYPE_CMD) { @@ -2757,8 +2758,8 @@ void handle_cdint(int error) if (!error && g_txrx_flag) { g_txrx_flag = false; -#if CONFIG_ZEPHYR - (void)OSA_EventNotifyPost(wm_wifi.wifi_core_task_Handle); +#ifdef __ZEPHYR__ + (void)OSA_TaskNotifyPost(wm_wifi.wifi_core_task_Handle); #else (void)OSA_EventSet((osa_event_handle_t)wm_wifi.wifi_event_Handle, WIFI_EVENT_SDIO); #endif diff --git a/zephyr/module.yml b/zephyr/module.yml index fa2731e17..3a510175b 100644 --- a/zephyr/module.yml +++ b/zephyr/module.yml @@ -45,4 +45,12 @@ blobs: license-path: zephyr/blobs/license/LA_OPT_NXP_Software_License.txt url: https://github.com/nxp-mcuxpresso/mcux-sdk-middleware-bluetooth-controller/raw/refs/tags/MCUX_2.16.000/bin/mcxw71_nbu_ble_1_9_14_0.sb3 description: "BLE Controller for MCXW71 boards" - +#SD8987 + - path: SD8987/sduart8987_wlan_bt.bin.inc + sha256: e8f0db42a54769d5d1c54f2b931121713211d3925acb3c8753f117f6376c8ffb + type: img + version: '1.0' + license-path: zephyr/blobs/license/LA_OPT_NXP_Software_License.txt + url: https://raw.githubusercontent.com/NXP/wifi_nxp/mcux_wifi_release/wifi_bt_firmware/8987/sduart8987_wlan_bt.bin.inc + description: "Firmware for NXP SD8987 Wi-Fi + Bluetooth single-chip solution" + doc-url: https://github.com/NXP/wifi_nxp/blob/mcux_wifi_release/wifi_bt_firmware/version.txt \ No newline at end of file