diff --git a/boards/shields/nxp_m2_wifi_bt/boards/mimxrt1060_evk_mimxrt1062_qspi_C.overlay b/boards/shields/nxp_m2_wifi_bt/boards/mimxrt1060_evk_mimxrt1062_qspi_C.overlay index c3802f5bc5ab8..3471cb7b7d14a 100644 --- a/boards/shields/nxp_m2_wifi_bt/boards/mimxrt1060_evk_mimxrt1062_qspi_C.overlay +++ b/boards/shields/nxp_m2_wifi_bt/boards/mimxrt1060_evk_mimxrt1062_qspi_C.overlay @@ -34,6 +34,13 @@ pinctrl-names = "default", "slow", "med", "fast", "nopull"; }; +&usdhc1 { + nxp_wifi { + pwr-gpios = <&gpio1 19 GPIO_ACTIVE_HIGH>; + sd-gpios = <&gpio1 24 GPIO_ACTIVE_HIGH>; + }; +}; + &pinctrl { /* removes pull on dat3 for card detect */ pinmux_usdhc1_dat3_nopull: pinmux_usdhc1_dat3_nopull { diff --git a/drivers/wifi/nxp/nxp_wifi_drv.c b/drivers/wifi/nxp/nxp_wifi_drv.c index 98ded6bd4f1d6..6afb615afb07c 100644 --- a/drivers/wifi/nxp/nxp_wifi_drv.c +++ b/drivers/wifi/nxp/nxp_wifi_drv.c @@ -1,5 +1,5 @@ /** - * Copyright 2023-2024 NXP + * Copyright 2023-2025 NXP * SPDX-License-Identifier: Apache-2.0 * * @file nxp_wifi_drv.c @@ -394,6 +394,77 @@ int nxp_wifi_wlan_event_callback(enum wlan_event_reason reason, void *data) return 0; } +static int nxp_wifi_cpu_reset(uint8_t enable) +{ + int err = 0; +#if DT_NODE_HAS_PROP(DT_DRV_INST(0), sd_gpios) && \ + DT_NODE_HAS_PROP(DT_DRV_INST(0), pwr_gpios) + + struct gpio_dt_spec sdio_reset = GPIO_DT_SPEC_GET(DT_DRV_INST(0), sd_gpios); + struct gpio_dt_spec pwr_gpios = GPIO_DT_SPEC_GET(DT_DRV_INST(0), pwr_gpios); + + if (!gpio_is_ready_dt(&sdio_reset)) { + LOG_ERR("Error: failed to configure sdio_reset %s pin %d", sdio_reset.port->name, + sdio_reset.pin); + return -EIO; + } + + /* Configure sdio_reset as output */ + err = gpio_pin_configure_dt(&sdio_reset, GPIO_OUTPUT); + if (err) { + LOG_ERR("Error %d: failed to configure sdio_reset %s pin %d", err, + sdio_reset.port->name, sdio_reset.pin); + return err; + } + + if (!gpio_is_ready_dt(&pwr_gpios)) { + LOG_ERR("Error: failed to configure pwr_gpios %s pin %d", pwr_gpios.port->name, + pwr_gpios.pin); + return -EIO; + } + + /* Configure wlan-power-io as an output */ + err = gpio_pin_configure_dt(&pwr_gpios, GPIO_OUTPUT); + if (err) { + LOG_ERR("Error %d: failed to configure pwr_gpios %s pin %d", err, + pwr_gpios.port->name, pwr_gpios.pin); + return err; + } + + if (enable) { + /* Set SDIO reset pin as high */ + err = gpio_pin_set_dt(&sdio_reset, 1); + if (err) { + return err; + } + /* wait for reset done */ + k_sleep(K_MSEC(100)); + + /* Set power gpio pin as high */ + err = gpio_pin_set_dt(&pwr_gpios, 1); + if (err) { + return err; + } + } else { + /* Set SDIO reset pin as low */ + err = gpio_pin_set_dt(&sdio_reset, 0); + if (err) { + return err; + } + + /* Set power gpio pin as low */ + err = gpio_pin_set_dt(&pwr_gpios, 0); + if (err) { + return err; + } + } + /* wait for reset done */ + k_sleep(K_MSEC(100)); +#endif + + return err; +} + static int nxp_wifi_wlan_init(void) { int status = NXP_WIFI_RET_SUCCESS; @@ -407,7 +478,9 @@ static int nxp_wifi_wlan_init(void) k_event_init(&s_nxp_wifi_SyncEvent); } - if (status == NXP_WIFI_RET_SUCCESS) { + ret = nxp_wifi_cpu_reset(true); + + if ((status == NXP_WIFI_RET_SUCCESS) && (ret == 0)) { ret = wlan_init(wlan_fw_bin, wlan_fw_bin_len); if (ret != WM_SUCCESS) { status = NXP_WIFI_RET_FAIL; diff --git a/dts/bindings/sdhc/nxp,imx-usdhc.yaml b/dts/bindings/sdhc/nxp,imx-usdhc.yaml index 4e217d0c7dbbe..d702622d7f875 100644 --- a/dts/bindings/sdhc/nxp,imx-usdhc.yaml +++ b/dts/bindings/sdhc/nxp,imx-usdhc.yaml @@ -46,6 +46,14 @@ properties: property value should ensure the flags properly describe the signal that is presented to the driver. + sd-gpios: + type: phandle-array + description: | + SDIO Reset pin + This pin defaults to active high when consumed by the SD card. The + property value should ensure the flags properly describe the signal + that is presented to the driver. + cd-gpios: type: phandle-array description: | diff --git a/dts/bindings/wifi/nxp,wifi.yaml b/dts/bindings/wifi/nxp,wifi.yaml index bbb3502669005..8827014cbd2b2 100644 --- a/dts/bindings/wifi/nxp,wifi.yaml +++ b/dts/bindings/wifi/nxp,wifi.yaml @@ -1,4 +1,4 @@ -# Copyright 2023-2024 NXP +# Copyright 2023-2025 NXP # # SPDX-License-Identifier: Apache-2.0 @@ -17,3 +17,18 @@ properties: This pin defaults to active low when consumed by the SDK card. The property value should ensure the flags properly describ the signal that is presendted to the driver. + pwr-gpios: + type: phandle-array + description: | + Power pin + This pin defaults to active high when consumed by the wlan cpu power. + The property value should ensure the flags properly describe the signal + that is presented to the driver. + + sd-gpios: + type: phandle-array + description: | + SDIO Reset pin + This pin defaults to active high when consumed by the SD card. The + property value should ensure the flags properly describe the signal + that is presented to the driver. diff --git a/samples/net/wifi/shell/boards/mimxrt1060_evk_mimxrt1062_qspi_C.conf b/samples/net/wifi/shell/boards/mimxrt1060_evk_mimxrt1062_qspi_C.conf index 583de34c4e90e..89d19a8ed820c 100644 --- a/samples/net/wifi/shell/boards/mimxrt1060_evk_mimxrt1062_qspi_C.conf +++ b/samples/net/wifi/shell/boards/mimxrt1060_evk_mimxrt1062_qspi_C.conf @@ -8,7 +8,6 @@ CONFIG_NXP_MONOLITHIC_WIFI=y # wifi driver CONFIG_NXP_WIFI_TX_TASK_PRIO=3 -CONFIG_NXP_WIFI_DRIVER_TASK_PRIO=3 # net CONFIG_NET_PKT_RX_COUNT=80 @@ -26,7 +25,7 @@ CONFIG_ZPERF_WORK_Q_THREAD_PRIORITY=3 CONFIG_NET_SOCKETS_SERVICE_THREAD_PRIO=3 CONFIG_NET_CONTEXT_PRIORITY=y CONFIG_NET_MGMT_THREAD_PRIO_CUSTOM=y -CONFIG_NET_MGMT_THREAD_PRIORITY=5 +CONFIG_NET_MGMT_THREAD_PRIORITY=3 CONFIG_IDLE_STACK_SIZE=1024 # stack size diff --git a/samples/net/wifi/shell/nxp/overlay_hosted_mcu.conf b/samples/net/wifi/shell/nxp/overlay_hosted_mcu.conf index aa1fe8bbe9713..cc97e1e2955b2 100644 --- a/samples/net/wifi/shell/nxp/overlay_hosted_mcu.conf +++ b/samples/net/wifi/shell/nxp/overlay_hosted_mcu.conf @@ -40,11 +40,14 @@ CONFIG_NET_IPV4=y CONFIG_NET_IPV6=y CONFIG_NET_ZPERF=y CONFIG_NET_ZPERF_MAX_PACKET_SIZE=1500 -CONFIG_NET_PKT_RX_COUNT=80 -CONFIG_NET_PKT_TX_COUNT=80 -CONFIG_NET_BUF_RX_COUNT=160 -CONFIG_NET_BUF_TX_COUNT=160 -CONFIG_NET_BUF_DATA_SIZE=1744 +CONFIG_NET_PKT_RX_COUNT=72 +CONFIG_NET_PKT_TX_COUNT=36 +CONFIG_NET_BUF_RX_COUNT=80 +CONFIG_NET_BUF_TX_COUNT=40 +CONFIG_NET_BUF_DATA_SIZE=1600 +CONFIG_NET_TCP_MAX_SEND_WINDOW_SIZE=46720 +CONFIG_NET_TCP_MAX_RECV_WINDOW_SIZE=46720 +CONFIG_NET_TC_TX_SKIP_FOR_HIGH_PRIO=y CONFIG_NET_TC_TX_COUNT=1 CONFIG_NET_TC_RX_COUNT=1 CONFIG_NET_MGMT_EVENT_QUEUE_SIZE=40