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 3/4] serial: i.MX: Add i.MX1 lowlevel init function
Date: Wed, 14 Aug 2019 10:16:58 +0200	[thread overview]
Message-ID: <20190814081659.22670-4-s.hauer@pengutronix.de> (raw)
In-Reply-To: <20190814081659.22670-1-s.hauer@pengutronix.de>

The i.MX1 uart must be initialized slightly differently than on other
SoCs. Add an i.MX1 specific init function.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 include/serial/imx-uart.h | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/include/serial/imx-uart.h b/include/serial/imx-uart.h
index c23606569d..23cee26fcf 100644
--- a/include/serial/imx-uart.h
+++ b/include/serial/imx-uart.h
@@ -155,6 +155,27 @@ static inline void imx_uart_set_dte(void __iomem *uartbase)
 	writel(ufcr, uartbase + UFCR);
 }
 
+static inline void imx1_uart_setup(void __iomem *uartbase)
+{
+	unsigned int refclock = 16000000;
+
+	writel(UCR1_UARTCLKEN, uartbase + UCR1);
+
+	writel(UCR2_IRTS | UCR2_WS | UCR2_TXEN | UCR2_RXEN | UCR2_SRST,
+	       uartbase + UCR2);
+	writel(0, uartbase + UCR3);
+
+	writel((0b10 << UFCR_TXTL_SHF) | UFCR_RFDIV1 | (1 << UFCR_RXTL_SHF),
+	       uartbase + UFCR);
+
+	writel(baudrate_to_ubir(CONFIG_BAUDRATE),
+	       uartbase + UBIR);
+	writel(refclock_to_ubmr(refclock),
+	       uartbase + UBMR);
+
+	writel(UCR1_UARTCLKEN | UCR1_UARTEN, uartbase + UCR1);
+}
+
 static inline void imx50_uart_setup(void __iomem *uartbase)
 {
 	imx_uart_setup(uartbase, 66666666);
-- 
2.20.1


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

  parent reply	other threads:[~2019-08-14  8:17 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-14  8:16 [PATCH 0/4] i.MX1/scb9328 patches Sascha Hauer
2019-08-14  8:16 ` [PATCH 1/4] pinctrl: i.MX iomux-v1: Make base address initialization unnecessary Sascha Hauer
2019-08-14  8:16 ` [PATCH 2/4] pinctrl: i.MX iomux-v1: Add i.MX1 support Sascha Hauer
2019-08-14  8:16 ` Sascha Hauer [this message]
2019-08-14  8:16 ` [PATCH 4/4] ARM: i.MX: scb9328: refurbish board suport Sascha Hauer

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=20190814081659.22670-4-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