Skip to content

Commit

Permalink
drivers: wifi: nxp: Fix the compilation error on the MIMXRT1170_EVK b…
Browse files Browse the repository at this point in the history
…oard with the NXP_88W8987_MURATA_1ZM_M2 WiFi module

- Fix the compilation error on the MIMXRT1170_EVK board with the NXP_88W8987_MURATA_1ZM_M2 WiFi module

Signed-off-by: csbobo <[email protected]>
  • Loading branch information
CsBoBoNice committed Dec 17, 2024
1 parent d2e2514 commit f8d48bd
Show file tree
Hide file tree
Showing 8 changed files with 191 additions and 45 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ else()
endif()

add_subdirectory(zephyr/src)
zephyr_include_directories_ifdef(CONFIG_NXP_88W8987 zephyr/blobs/SD8987)
76 changes: 58 additions & 18 deletions mcux/middleware/wifi_nxp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
Expand Down
2 changes: 2 additions & 0 deletions mcux/middleware/wifi_nxp/firmware_dnld/firmware_dnld.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 2 additions & 0 deletions mcux/middleware/wifi_nxp/sdio_nxp_abs/incl/mlan_sdio_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -54,6 +55,7 @@

/* Depends on DMA_BUFSZ */
#define DMA_BOUNDARY_SIZE (512 * 1024)
#endif

/** Read Card Register
*
Expand Down
97 changes: 94 additions & 3 deletions mcux/middleware/wifi_nxp/sdio_nxp_abs/mlan_sdio.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,16 @@
* SPDX-License-Identifier: BSD-3-Clause
*
*/
#include <wmerrno.h>
#include <board.h>
#include <wifi_bt_config.h>


#include <mlan_sdio_api.h>
#include <osa.h>
#include <fsl_common.h>
#include <fsl_gpio.h>
#include <zephyr/sd/sdio.h>

#include <zephyr/drivers/gpio.h>

#define SDIO_CMD_TIMEOUT 2000

const struct device *sdhc_dev = DEVICE_DT_GET(DT_BUS(DT_COMPAT_GET_ANY_STATUS_OKAY(nxp_wifi)));
Expand Down Expand Up @@ -87,16 +89,105 @@ 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)
{
int ret = WM_SUCCESS;
uint32_t resp;

BOARD_WIFI_BT_Enable(true);

if (!device_is_ready(sdhc_dev))
{
sdio_e("SD controller not ready");
Expand Down
41 changes: 21 additions & 20 deletions mcux/middleware/wifi_nxp/wifidriver/mlan_glue.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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:
{
Expand Down
Loading

0 comments on commit f8d48bd

Please sign in to comment.