From: "Andreas Färber" <afaerber@suse.de>
To: linux-meson@googlegroups.com
Cc: "Carlo Caione" <carlo@caione.org>,
linux-arm-kernel@lists.infradead.org,
"Matthias Brugger" <mbrugger@suse.com>,
"Nicolas Saenz" <nicolassaenzj@gmail.com>,
"Andreas Färber" <afaerber@suse.de>,
"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
"Jiri Slaby" <jslaby@suse.com>,
"open list:SERIAL DRIVERS" <linux-serial@vger.kernel.org>,
"open list" <linux-kernel@vger.kernel.org>
Subject: [PATCH] tty: serial: meson: Add support for XTAL clock input
Date: Mon, 8 Feb 2016 13:49:42 +0100 [thread overview]
Message-ID: <1454935783-17027-1-git-send-email-afaerber@suse.de> (raw)
Fix the baudrate calculation for 24 MHz XTAL clock found on gxbb platforms.
Signed-off-by: Andreas Färber <afaerber@suse.de>
---
Forward-ported from vendor kernel. On top of my meson earlycon patch.
drivers/tty/serial/meson_uart.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/drivers/tty/serial/meson_uart.c b/drivers/tty/serial/meson_uart.c
index 9efcfa2de31e..4415631bab17 100644
--- a/drivers/tty/serial/meson_uart.c
+++ b/drivers/tty/serial/meson_uart.c
@@ -78,6 +78,7 @@
/* AML_UART_REG5 bits */
#define AML_UART_BAUD_MASK 0x7fffff
#define AML_UART_BAUD_USE BIT(23)
+#define AML_UART_BAUD_XTAL BIT(24)
#define AML_UART_PORT_NUM 6
#define AML_UART_DEV_NAME "ttyAML"
@@ -299,7 +300,12 @@ static void meson_uart_change_speed(struct uart_port *port, unsigned long baud)
val = readl(port->membase + AML_UART_REG5);
val &= ~AML_UART_BAUD_MASK;
- val = ((port->uartclk * 10 / (baud * 4) + 5) / 10) - 1;
+ if (port->uartclk == 24000000) {
+ val = ((port->uartclk / 3) / baud) - 1;
+ val |= AML_UART_BAUD_XTAL;
+ } else {
+ val = ((port->uartclk * 10 / (baud * 4) + 5) / 10) - 1;
+ }
val |= AML_UART_BAUD_USE;
writel(val, port->membase + AML_UART_REG5);
}
--
2.6.2
next reply other threads:[~2016-02-08 12:49 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-08 12:49 Andreas Färber [this message]
2016-02-09 22:00 ` [PATCH] tty: serial: meson: Add support for XTAL clock input Carlo Caione
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=1454935783-17027-1-git-send-email-afaerber@suse.de \
--to=afaerber@suse.de \
--cc=carlo@caione.org \
--cc=gregkh@linuxfoundation.org \
--cc=jslaby@suse.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-meson@googlegroups.com \
--cc=linux-serial@vger.kernel.org \
--cc=mbrugger@suse.com \
--cc=nicolassaenzj@gmail.com \
/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;
as well as URLs for NNTP newsgroup(s).