mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] serial: imx: Support DTE mode
@ 2016-02-25  6:50 Sascha Hauer
  0 siblings, 0 replies; only message in thread
From: Sascha Hauer @ 2016-02-25  6:50 UTC (permalink / raw)
  To: Barebox List

Based on Kernel commit 20ff2fe60a: serial: imx: add support for DTE mode

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 drivers/serial/serial_imx.c | 11 +++++++++--
 include/serial/imx-uart.h   |  1 +
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/drivers/serial/serial_imx.c b/drivers/serial/serial_imx.c
index 68b438b..563813a 100644
--- a/drivers/serial/serial_imx.c
+++ b/drivers/serial/serial_imx.c
@@ -55,6 +55,7 @@ static struct imx_serial_devtype_data imx21_data = {
 struct imx_serial_priv {
 	struct console_device cdev;
 	int baudrate;
+	int dte_mode;
 	struct notifier_block notify;
 	void __iomem *regs;
 	struct clk *clk;
@@ -93,9 +94,12 @@ static int imx_serial_init_port(struct console_device *cdev)
 	writel(0, regs + UBMR);
 	writel(0, regs + priv->devtype->uts);
 
-
 	/* Configure FIFOs */
-	writel(0xa81, regs + UFCR);
+	val = 0xa81;
+	if (priv->dte_mode)
+		val |= UFCR_DCEDTE;
+
+	writel(val, regs + UFCR);
 
 
 	if (priv->devtype->onems)
@@ -240,6 +244,9 @@ static int imx_serial_probe(struct device_d *dev)
 		}
 	}
 
+	if (of_property_read_bool(dev->device_node, "fsl,dte-mode"))
+		priv->dte_mode = 1;
+
 	imx_serial_init_port(cdev);
 
 	/* Enable UART */
diff --git a/include/serial/imx-uart.h b/include/serial/imx-uart.h
index 8faa12f..29b117c 100644
--- a/include/serial/imx-uart.h
+++ b/include/serial/imx-uart.h
@@ -84,6 +84,7 @@
 #define	 UFCR_RFDIV2	  (0b100<<7)  /* Reference freq divider mask */
 #define	 UFCR_RFDIV1	  (0b101<<7)  /* Reference freq divider mask */
 #define	 UFCR_RFDIV7	  (0b110<<7)  /* Reference freq divider mask */
+#define  UFCR_DCEDTE	 (1<<6)   /* DCE/DTE mode select */
 #define  UFCR_TXTL_SHF   10      /* Transmitter trigger level shift */
 #define  USR1_PARITYERR  (1<<15) /* Parity error interrupt flag */
 #define  USR1_RTSS  	 (1<<14) /* RTS pin status */
-- 
2.7.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2016-02-25  6:50 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-25  6:50 [PATCH] serial: imx: Support DTE mode Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox