All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] serial: serial_stm32: Add reset support
@ 2018-12-04 13:11 Patrice Chotard
  2018-12-06  1:31 ` Simon Glass
  2018-12-17 12:11 ` [U-Boot] " Tom Rini
  0 siblings, 2 replies; 3+ messages in thread
From: Patrice Chotard @ 2018-12-04 13:11 UTC (permalink / raw
  To: u-boot

In some cases, UART is configured by early boot stage.
To be sure of the initial state of UART and to avoid
spurious chars on console, reset the serial block before
configuring it.

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
---

 drivers/serial/serial_stm32.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/serial/serial_stm32.c b/drivers/serial/serial_stm32.c
index 31b43ee88dd7..e31c87b9ac5a 100644
--- a/drivers/serial/serial_stm32.c
+++ b/drivers/serial/serial_stm32.c
@@ -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);
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [U-Boot] [PATCH] serial: serial_stm32: Add reset support
  2018-12-04 13:11 [U-Boot] [PATCH] serial: serial_stm32: Add reset support Patrice Chotard
@ 2018-12-06  1:31 ` Simon Glass
  2018-12-17 12:11 ` [U-Boot] " Tom Rini
  1 sibling, 0 replies; 3+ messages in thread
From: Simon Glass @ 2018-12-06  1:31 UTC (permalink / raw
  To: u-boot

On Tue, 4 Dec 2018 at 06:11, Patrice Chotard <patrice.chotard@st.com> wrote:
>
> In some cases, UART is configured by early boot stage.
> To be sure of the initial state of UART and to avoid
> spurious chars on console, reset the serial block before
> configuring it.
>
> Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
> ---
>
>  drivers/serial/serial_stm32.c | 9 +++++++++
>  1 file changed, 9 insertions(+)

Reviewed-by: Simon Glass <sjg@chromium.org>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [U-Boot] serial: serial_stm32: Add reset support
  2018-12-04 13:11 [U-Boot] [PATCH] serial: serial_stm32: Add reset support Patrice Chotard
  2018-12-06  1:31 ` Simon Glass
@ 2018-12-17 12:11 ` Tom Rini
  1 sibling, 0 replies; 3+ messages in thread
From: Tom Rini @ 2018-12-17 12:11 UTC (permalink / raw
  To: u-boot

On Tue, Dec 04, 2018 at 02:11:36PM +0100, Patrice Chotard wrote:

> In some cases, UART is configured by early boot stage.
> To be sure of the initial state of UART and to avoid
> spurious chars on console, reset the serial block before
> configuring it.
> 
> Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
> Reviewed-by: Simon Glass <sjg@chromium.org>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20181217/f2faf065/attachment.sig>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-12-17 12:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-12-04 13:11 [U-Boot] [PATCH] serial: serial_stm32: Add reset support Patrice Chotard
2018-12-06  1:31 ` Simon Glass
2018-12-17 12:11 ` [U-Boot] " Tom Rini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.