Merge tag 'u-boot-stm32-20190523' of https://github.com/pchotard/u-boot
[oweals/u-boot.git] / drivers / serial / serial_stm32.c
index 31b43ee88dd7ed7857b200cae5ab9ee345bb5ff7..cca8b707acc42c8d3d10486a4a359940cdbba290 100644 (file)
@@ -7,6 +7,7 @@
 #include <common.h>
 #include <clk.h>
 #include <dm.h>
+#include <reset.h>
 #include <serial.h>
 #include <watchdog.h>
 #include <asm/io.h>
@@ -171,6 +172,7 @@ static int stm32_serial_probe(struct udevice *dev)
 {
        struct stm32x7_serial_platdata *plat = dev_get_platdata(dev);
        struct clk clk;
+       struct reset_ctl reset;
        int ret;
 
        plat->uart_info = (struct stm32_uart_info *)dev_get_driver_data(dev);
@@ -185,6 +187,13 @@ static int stm32_serial_probe(struct udevice *dev)
                return ret;
        }
 
+       ret = reset_get_by_index(dev, 0, &reset);
+       if (!ret) {
+               reset_assert(&reset);
+               udelay(2);
+               reset_deassert(&reset);
+       }
+
        plat->clock_rate = clk_get_rate(&clk);
        if (plat->clock_rate < 0) {
                clk_disable(&clk);
@@ -260,7 +269,6 @@ static inline void _debug_uart_init(void)
        _stm32_serial_setbrg(base, uart_info,
                             CONFIG_DEBUG_UART_CLOCK,
                             CONFIG_BAUDRATE);
-       printf("DEBUG done\n");
 }
 
 static inline void _debug_uart_putc(int c)
@@ -269,7 +277,7 @@ static inline void _debug_uart_putc(int c)
        struct stm32_uart_info *uart_info = _debug_uart_info();
 
        while (_stm32_serial_putc(base, uart_info, c) == -EAGAIN)
-               WATCHDOG_RESET();
+               ;
 }
 
 DEBUG_UART_FUNCS