Commit 146f3808 authored by Andreas Färber's avatar Andreas Färber Committed by Greg Kroah-Hartman

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: default avatarAndreas Färber <afaerber@suse.de>
Acked-by: default avatarCarlo Caione <carlo@endlessm.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent df247081
...@@ -78,6 +78,7 @@ ...@@ -78,6 +78,7 @@
/* AML_UART_REG5 bits */ /* AML_UART_REG5 bits */
#define AML_UART_BAUD_MASK 0x7fffff #define AML_UART_BAUD_MASK 0x7fffff
#define AML_UART_BAUD_USE BIT(23) #define AML_UART_BAUD_USE BIT(23)
#define AML_UART_BAUD_XTAL BIT(24)
#define AML_UART_PORT_NUM 6 #define AML_UART_PORT_NUM 6
#define AML_UART_DEV_NAME "ttyAML" #define AML_UART_DEV_NAME "ttyAML"
...@@ -299,7 +300,12 @@ static void meson_uart_change_speed(struct uart_port *port, unsigned long baud) ...@@ -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 = readl(port->membase + AML_UART_REG5);
val &= ~AML_UART_BAUD_MASK; val &= ~AML_UART_BAUD_MASK;
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 = ((port->uartclk * 10 / (baud * 4) + 5) / 10) - 1;
}
val |= AML_UART_BAUD_USE; val |= AML_UART_BAUD_USE;
writel(val, port->membase + AML_UART_REG5); writel(val, port->membase + AML_UART_REG5);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment