From: Max Krummenacher <max.krummenac...@toradex.com>

If the UART is used in DTE mode the RI and DCD bits in UCR3 become
irq enable bits. Both are set to enabled after reset and both likely
are pending.

Disable the bits also on UARTs not used in the boot loader to prevent
an interrupt storm when Linux enables the UART interrupts.

Signed-off-by: Max Krummenacher <max.krummenac...@toradex.com>
Acked-by: Marcel Ziswiler <marcel.ziswi...@toradex.com>

---

 board/toradex/apalis_imx6/apalis_imx6.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/board/toradex/apalis_imx6/apalis_imx6.c 
b/board/toradex/apalis_imx6/apalis_imx6.c
index 99bd9232dc..696994a6b6 100644
--- a/board/toradex/apalis_imx6/apalis_imx6.c
+++ b/board/toradex/apalis_imx6/apalis_imx6.c
@@ -236,8 +236,11 @@ iomux_v3_cfg_t const usb_pads[] = {
  * UARTs are used in DTE mode, switch the mode on all UARTs before
  * any pinmuxing connects a (DCE) output to a transceiver output.
  */
+#define UCR3           0x88    /* FIFO Control Register */
+#define UCR3_RI                BIT(8)  /* RIDELT DTE mode */
+#define UCR3_DCD       BIT(9)  /* DCDDELT DTE mode */
 #define UFCR           0x90    /* FIFO Control Register */
-#define UFCR_DCEDTE    (1<<6)  /* DCE=0 */
+#define UFCR_DCEDTE    BIT(6)  /* DCE=0 */
 
 static void setup_dtemode_uart(void)
 {
@@ -245,6 +248,11 @@ static void setup_dtemode_uart(void)
        setbits_le32((u32 *)(UART2_BASE + UFCR), UFCR_DCEDTE);
        setbits_le32((u32 *)(UART4_BASE + UFCR), UFCR_DCEDTE);
        setbits_le32((u32 *)(UART5_BASE + UFCR), UFCR_DCEDTE);
+
+       clrbits_le32((u32 *)(UART1_BASE + UCR3), UCR3_DCD | UCR3_RI);
+       clrbits_le32((u32 *)(UART2_BASE + UCR3), UCR3_DCD | UCR3_RI);
+       clrbits_le32((u32 *)(UART4_BASE + UCR3), UCR3_DCD | UCR3_RI);
+       clrbits_le32((u32 *)(UART5_BASE + UCR3), UCR3_DCD | UCR3_RI);
 }
 static void setup_dcemode_uart(void)
 {
-- 
2.20.1

_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot

Reply via email to