summaryrefslogtreecommitdiff
path: root/drivers/tty/serial/meson_uart.c
diff options
context:
space:
mode:
authorAndreas Färber <afaerber@suse.de>2016-02-08 15:49:42 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2016-02-15 04:39:36 +0300
commit146f3808e08faabba46ea9574133a66aa4a9468d (patch)
tree3e55c7fe128bed33568dc971b90bc3bbf6fcbe09 /drivers/tty/serial/meson_uart.c
parentdf247081afc0dbd57472d653c587210c511f6931 (diff)
downloadlinux-146f3808e08faabba46ea9574133a66aa4a9468d.tar.xz
tty: serial: meson: Add support for XTAL clock input
Fix the baudrate calculation for 24 MHz XTAL clock found on gxbb platforms. Signed-off-by: Andreas Färber <afaerber@suse.de> Acked-by: Carlo Caione <carlo@endlessm.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty/serial/meson_uart.c')
-rw-r--r--drivers/tty/serial/meson_uart.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/tty/serial/meson_uart.c b/drivers/tty/serial/meson_uart.c
index b12a37bd37b6..024445aa0521 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);
}