Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

drivers: wifi: nxp:Fix the compilation error on the MIMXRT1170_EVK board with the NXP_88W8987_MURATA_1ZM_M2 WiFi module #473

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
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)
add_subdirectory_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)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This approach makes sense, but we should expand it out to manage other modules (for example the IW416)

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
36 changes: 22 additions & 14 deletions mcux/middleware/wifi_nxp/incl/nxp_wifi.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,32 +82,40 @@ extern "C" {
#define CONFIG_WIFI_STA_RECONNECT 1
#endif

#if CONFIG_NXP_WIFI_MON_THREAD_STACK_SIZE
#define CONFIG_MON_THREAD_STACK_SIZE CONFIG_NXP_WIFI_MON_THREAD_STACK_SIZE
#if CONFIG_NXP_WIFI_MON_TASK_STACK_SIZE
#define CONFIG_MON_STACK_SIZE CONFIG_NXP_WIFI_MON_TASK_STACK_SIZE
#endif

#if CONFIG_NXP_WIFI_WLCMGR_STACK_SIZE
#define CONFIG_WLCMGR_STACK_SIZE CONFIG_NXP_WIFI_WLCMGR_STACK_SIZE
#if CONFIG_NXP_WIFI_WLCMGR_TASK_STACK_SIZE
#define CONFIG_WLCMGR_STACK_SIZE CONFIG_NXP_WIFI_WLCMGR_TASK_STACK_SIZE
#endif

#if CONFIG_NXP_WIFI_WPS_STACK_SIZE
#define CONFIG_WPS_STACK_SIZE CONFIG_NXP_WIFI_WPS_STACK_SIZE
#if CONFIG_NXP_WIFI_WPS_TASK_STACK_SIZE
#define CONFIG_WPS_STACK_SIZE CONFIG_NXP_WIFI_WPS_TASK_STACK_SIZE
#endif

#if CONFIG_NXP_WIFI_POWERSAVE_STACK_SIZE
#define CONFIG_POWERSAVE_STACK_SIZE CONFIG_NXP_WIFI_POWERSAVE_STACK_SIZE
#if CONFIG_NXP_WIFI_POWERSAVE_TASK_STACK_SIZE
#define CONFIG_POWERSAVE_STACK_SIZE CONFIG_NXP_WIFI_POWERSAVE_TASK_STACK_SIZE
#endif

#if CONFIG_NXP_WIFI_TX_STACK_SIZE
#define CONFIG_TX_STACK_SIZE CONFIG_NXP_WIFI_TX_STACK_SIZE
#if CONFIG_NXP_WIFI_TX_TASK_STACK_SIZE
#define CONFIG_TX_STACK_SIZE CONFIG_NXP_WIFI_TX_TASK_STACK_SIZE
#endif

#if CONFIG_NXP_WIFI_DRIVER_STACK_SIZE
#define CONFIG_DRIVER_STACK_SIZE CONFIG_NXP_WIFI_DRIVER_STACK_SIZE
#if CONFIG_NXP_WIFI_DRIVER_TASK_STACK_SIZE
#define CONFIG_DRIVER_STACK_SIZE CONFIG_NXP_WIFI_DRIVER_TASK_STACK_SIZE
#endif

#if CONFIG_NXP_WIFI_DHCP_SERVER_STACK_SIZE
#define CONFIG_DHCP_SERVER_STACK_SIZE CONFIG_NXP_WIFI_DHCP_SERVER_STACK_SIZE
#if CONFIG_NXP_WIFI_DHCP_SERVER_TASK_STACK_SIZE
#define CONFIG_DHCP_SERVER_STACK_SIZE CONFIG_NXP_WIFI_DHCP_SERVER_TASK_STACK_SIZE
#endif

#if CONFIG_NXP_WIFI_CORE_TASK_STACK_SIZE
#define CONFIG_CORE_STACK_SIZE CONFIG_NXP_WIFI_CORE_TASK_STACK_SIZE
#endif

#if CONFIG_NXP_WIFI_SCAN_TASK_STACK_SIZE
#define CONFIG_SCAN_STACK_SIZE CONFIG_NXP_WIFI_SCAN_TASK_STACK_SIZE
#endif

#if CONFIG_NXP_WIFI_11AX
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
Loading