[U-Boot] [PATCH v2 5/7] serial: stm32f7: disable overrun

Vikas Manocha vikas.manocha at st.com
Sun May 28 19:55:12 UTC 2017


With overrun enabled, serial port console freezes & stops receiving data with
overun error if we keep sending data.

Signed-off-by: Vikas Manocha <vikas.manocha at st.com>
---

Changed in v2: None

 drivers/serial/serial_stm32x7.c | 3 +++
 drivers/serial/serial_stm32x7.h | 2 ++
 2 files changed, 5 insertions(+)

diff --git a/drivers/serial/serial_stm32x7.c b/drivers/serial/serial_stm32x7.c
index 1907cef..2b305cd 100644
--- a/drivers/serial/serial_stm32x7.c
+++ b/drivers/serial/serial_stm32x7.c
@@ -93,6 +93,9 @@ static int stm32_serial_probe(struct udevice *dev)
 	}
 #endif
 
+	/* Disable usart-> disable overrun-> enable usart */
+	clrbits_le32(&usart->cr1, USART_CR1_RE | USART_CR1_TE | USART_CR1_UE);
+	setbits_le32(&usart->cr3, USART_CR3_OVRDIS);
 	setbits_le32(&usart->cr1, USART_CR1_RE | USART_CR1_TE | USART_CR1_UE);
 
 	return 0;
diff --git a/drivers/serial/serial_stm32x7.h b/drivers/serial/serial_stm32x7.h
index 6190d67..8c02548 100644
--- a/drivers/serial/serial_stm32x7.h
+++ b/drivers/serial/serial_stm32x7.h
@@ -27,6 +27,8 @@ struct stm32_usart {
 #define USART_CR1_TE			(1 << 3)
 #define USART_CR1_UE			(1 << 0)
 
+#define USART_CR3_OVRDIS		(1 << 12)
+
 #define USART_SR_FLAG_RXNE		(1 << 5)
 #define USART_SR_FLAG_TXE		(1 << 7)
 
-- 
1.9.1



More information about the U-Boot mailing list