serial: stm32f7: disable overrun
authorVikas Manocha <vikas.manocha@st.com>
Sun, 28 May 2017 19:55:12 +0000 (12:55 -0700)
committerTom Rini <trini@konsulko.com>
Fri, 9 Jun 2017 15:23:59 +0000 (11:23 -0400)
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@st.com>
drivers/serial/serial_stm32x7.c
drivers/serial/serial_stm32x7.h

index bdabf87e50eee856bb184f718e7c37b638acaa42..483e4ba67d9fb27a6b4c58d87d15cfe43acb7c48 100644 (file)
@@ -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;
index 6190d67406b3f08ace6d0a7f708238555d70a015..8c025485cd918550f7441170ce635b2cfae9dd51 100644 (file)
@@ -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)