diff --git a/drivers/wifi/esp_at/esp.c b/drivers/wifi/esp_at/esp.c index 4df808c1480..5722928ac0e 100644 --- a/drivers/wifi/esp_at/esp.c +++ b/drivers/wifi/esp_at/esp.c @@ -1177,7 +1177,7 @@ static void esp_init_work(struct k_work *work) static int esp_reset(const struct device *dev) { struct esp_data *data = dev->data; - int ret; + int ret = -EAGAIN; if (net_if_is_carrier_ok(data->net_iface)) { net_if_carrier_off(data->net_iface); @@ -1196,9 +1196,14 @@ static int esp_reset(const struct device *dev) k_sleep(K_MSEC(100)); gpio_pin_set_dt(&config->reset, 0); #else +#if DT_INST_NODE_HAS_PROP(0, external_reset) + /* Wait to see if the interface comes up by itself */ + ret = k_sem_take(&data->sem_if_ready, K_MSEC(CONFIG_WIFI_ESP_AT_RESET_TIMEOUT)); +#endif int retries = 3; - while (retries--) { + /* Don't need to run this if the interface came up by itself */ + while ((ret != 0) && retries--) { ret = modem_cmd_send(&data->mctx.iface, &data->mctx.cmd_handler, NULL, 0, "AT+RST", &data->sem_if_ready, K_MSEC(CONFIG_WIFI_ESP_AT_RESET_TIMEOUT)); diff --git a/dts/bindings/wifi/espressif,esp-at.yaml b/dts/bindings/wifi/espressif,esp-at.yaml index 312db8b5727..33f9a492bfe 100644 --- a/dts/bindings/wifi/espressif,esp-at.yaml +++ b/dts/bindings/wifi/espressif,esp-at.yaml @@ -14,6 +14,12 @@ properties: reset-gpios: type: phandle-array + external-reset: + type: boolean + description: + Modem is reset by an external source. In most situations this will + be the microcontroller and the ESP modem on a common reset line. + target-speed: type: int description: