Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
77 changes: 75 additions & 2 deletions drivers/wifi/nxp/nxp_wifi_drv.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright 2023-2024 NXP
* Copyright 2023-2025 NXP
* SPDX-License-Identifier: Apache-2.0
*
* @file nxp_wifi_drv.c
Expand Down Expand Up @@ -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 */
Copy link
Contributor

Choose a reason for hiding this comment

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

is this for pwr_gpios if so please update comment?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I did not understand, can you let me know what comment are you expecting?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi @krish2718 ,
Can you update else please help approving?

Copy link
Contributor

Choose a reason for hiding this comment

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

@abhinavnxp @krish2718 is asking you to update the commit message with the details about the above change.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@krish2718 @mmahadevan108 please check now

k_sleep(K_MSEC(100));
#endif

return err;
}

static int nxp_wifi_wlan_init(void)
{
int status = NXP_WIFI_RET_SUCCESS;
Expand All @@ -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;
Expand Down
8 changes: 8 additions & 0 deletions dts/bindings/sdhc/nxp,imx-usdhc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down
17 changes: 16 additions & 1 deletion dts/bindings/wifi/nxp,wifi.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2023-2024 NXP
# Copyright 2023-2025 NXP
#
# SPDX-License-Identifier: Apache-2.0

Expand All @@ -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.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
13 changes: 8 additions & 5 deletions samples/net/wifi/shell/nxp/overlay_hosted_mcu.conf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading