]> Git Repo - esp-hosted.git/commitdiff
Allow to specify reset pins via DT master example
authorJesse Taube <[email protected]>
Thu, 8 Dec 2022 22:35:06 +0000 (17:35 -0500)
committerJesse Taube <[email protected]>
Sat, 6 Jul 2024 23:36:02 +0000 (19:36 -0400)
Some people may want to define all pins in the device tree. This patch
allows to specify the reset pin via the device tree.

NOTE: For sdio the reset pin must be pulled low ~200ms before probe is called.
Or be called ~500ms after probe is called.

Signed-off-by: Jesse Taube <[email protected]>
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.028783 seconds and 4 git commands to generate.