]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
serial: stm32: add Framing error support
authorPatrick Delaunay <patrick.delaunay@st.com>
Tue, 30 Jul 2019 17:16:46 +0000 (19:16 +0200)
committerPatrice Chotard <patrice.chotard@st.com>
Tue, 27 Aug 2019 09:19:23 +0000 (11:19 +0200)
Add management of Bit 1 of USART_ISR = FE: Framing error
This bit is set by hardware when a de-synchronization, excessive noise
or a break character is detected. It is cleared by software, writing 1
to the FECF bit in the USART_ICR register (for stm32 after f4).

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
drivers/serial/serial_stm32.c
drivers/serial/serial_stm32.h

index 3ab536a52ac032c270b3d341c1ca2554d1ecbe8d..00a8e7249b55717c172d4ed0eb4b18df73d6bf4e 100644 (file)
@@ -106,10 +106,11 @@ static int stm32_serial_getc(struct udevice *dev)
        if ((isr & USART_ISR_RXNE) == 0)
                return -EAGAIN;
 
-       if (isr & (USART_ISR_PE | USART_ISR_ORE)) {
+       if (isr & (USART_ISR_PE | USART_ISR_ORE | USART_ISR_FE)) {
                if (!stm32f4)
                        setbits_le32(base + ICR_OFFSET,
-                                    USART_ICR_PCECF | USART_ICR_ORECF);
+                                    USART_ICR_PCECF | USART_ICR_ORECF |
+                                    USART_ICR_FECF);
                else
                        readl(base + RDR_OFFSET(stm32f4));
                return -EIO;
index 5549f8c5368ab2ddbcd7669a4f065d1e8acac5f2..7b0c53145e8b722cec880625f9a99d652a2dc0a8 100644 (file)
@@ -67,6 +67,7 @@ struct stm32x7_serial_platdata {
 #define USART_ISR_TXE                  BIT(7)
 #define USART_ISR_RXNE                 BIT(5)
 #define USART_ISR_ORE                  BIT(3)
+#define USART_ISR_FE                   BIT(1)
 #define USART_ISR_PE                   BIT(0)
 
 #define USART_BRR_F_MASK               GENMASK(7, 0)
@@ -74,6 +75,7 @@ struct stm32x7_serial_platdata {
 #define USART_BRR_M_MASK               GENMASK(15, 4)
 
 #define USART_ICR_ORECF                        BIT(3)
+#define USART_ICR_FECF                 BIT(1)
 #define USART_ICR_PCECF                        BIT(0)
 
 #endif