]> Git Repo - esp-hosted.git/blobdiff - esp_hosted_ng/host/main.c
Allow to specify reset pins via DT
[esp-hosted.git] / esp_hosted_ng / host / main.c
index d0ed8eda7399bd71891388693d8a192dfef1c8a0..977f6cb6ef4a4d29458cb8a4fb2e68eadc1fa154 100644 (file)
@@ -993,12 +993,32 @@ static void esp_reset(void)
        }
 }
 
+void dt_get_reset_pin(void)
+{
+       struct device_node *resetpin_node = NULL;
+       int temp_resetpin = HOST_GPIO_PIN_INVALID;
+
+
+       resetpin_node = of_find_compatible_node(NULL, NULL, "espressif,esp_sdio");
+       if (!resetpin_node)
+               resetpin_node = of_find_compatible_node(NULL, NULL, "espressif,esp_spi");
+       if (resetpin_node){
+               of_property_read_u32(resetpin_node, "resetpin", &temp_resetpin);
+               if (temp_resetpin == HOST_GPIO_PIN_INVALID)
+                       esp_warn("Unable to find resetpin in device tree.\n");
+               else
+                       resetpin = temp_resetpin;
+       }
+}
+
 static int __init esp_init(void)
 {
        int ret = 0;
        struct esp_adapter *adapter = NULL;
        struct esp_if_params if_params;
 
+       dt_get_reset_pin();
+
        /* Reset ESP, Clean start ESP */
        esp_reset();
        msleep(200);
This page took 0.026771 seconds and 4 git commands to generate.