mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Barebox List <barebox@lists.infradead.org>
Subject: [PATCH] serial: imx: Support DTE mode
Date: Thu, 25 Feb 2016 07:50:35 +0100	[thread overview]
Message-ID: <1456383035-28145-1-git-send-email-s.hauer@pengutronix.de> (raw)

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

                 reply	other threads:[~2016-02-25  6:50 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1456383035-28145-1-git-send-email-s.hauer@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox