drivers/linuxgpiod: add support for opendrain trst
[fw/openocd] / src / jtag / drivers / linuxgpiod.c
index dd50b44066616b207c745cdc1c43d743cd20e1d1..75f6152bec56f4adf7b88b4ba57b55748d4a69af 100644 (file)
@@ -360,7 +360,11 @@ static int linuxgpiod_init(void)
                        goto out_error;
 
                if (is_gpio_valid(trst_gpio)) {
-                       gpiod_trst = helper_get_output_line("trst", trst_gpio, 1);
+                       if (jtag_get_reset_config() & RESET_TRST_OPEN_DRAIN)
+                               gpiod_trst = helper_get_open_drain_output_line("trst", trst_gpio, 1);
+                       else
+                               gpiod_trst = helper_get_output_line("trst", trst_gpio, 1);
+
                        if (!gpiod_trst)
                                goto out_error;
                }