All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] tty: serial: meson: Add support for XTAL clock input
@ 2016-02-08 12:49 ` Andreas Färber
  0 siblings, 0 replies; 5+ messages in thread
From: Andreas Färber @ 2016-02-08 12:49 UTC (permalink / raw)
  To: linux-meson
  Cc: Carlo Caione, linux-arm-kernel, Matthias Brugger, Nicolas Saenz,
	Andreas Färber, Greg Kroah-Hartman, Jiri Slaby,
	open list:SERIAL DRIVERS, open list

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

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH] tty: serial: meson: Add support for XTAL clock input
@ 2016-02-08 12:49 ` Andreas Färber
  0 siblings, 0 replies; 5+ messages in thread
From: Andreas Färber @ 2016-02-08 12:49 UTC (permalink / raw)
  To: linux-meson
  Cc: Carlo Caione, linux-arm-kernel, Matthias Brugger, Nicolas Saenz,
	Andreas Färber, Greg Kroah-Hartman, Jiri Slaby,
	open list:SERIAL DRIVERS, open list

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

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH] tty: serial: meson: Add support for XTAL clock input
@ 2016-02-08 12:49 ` Andreas Färber
  0 siblings, 0 replies; 5+ messages in thread
From: Andreas Färber @ 2016-02-08 12:49 UTC (permalink / raw)
  To: linux-arm-kernel

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

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] tty: serial: meson: Add support for XTAL clock input
  2016-02-08 12:49 ` Andreas Färber
@ 2016-02-09 22:00   ` Carlo Caione
  -1 siblings, 0 replies; 5+ messages in thread
From: Carlo Caione @ 2016-02-09 22:00 UTC (permalink / raw)
  To: Andreas Färber
  Cc: linux-meson, Carlo Caione, linux-arm-kernel, Matthias Brugger,
	Nicolas Saenz, Greg Kroah-Hartman, Jiri Slaby,
	open list:SERIAL DRIVERS, open list

On Mon, Feb 8, 2016 at 1:49 PM, Andreas Färber <afaerber@suse.de> wrote:
> 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>

Thanks!

-- 
Carlo Caione

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH] tty: serial: meson: Add support for XTAL clock input
@ 2016-02-09 22:00   ` Carlo Caione
  0 siblings, 0 replies; 5+ messages in thread
From: Carlo Caione @ 2016-02-09 22:00 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Feb 8, 2016 at 1:49 PM, Andreas F?rber <afaerber@suse.de> wrote:
> 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>

Thanks!

-- 
Carlo Caione

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-02-09 22:00 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-08 12:49 [PATCH] tty: serial: meson: Add support for XTAL clock input Andreas Färber
2016-02-08 12:49 ` Andreas Färber
2016-02-08 12:49 ` Andreas Färber
2016-02-09 22:00 ` Carlo Caione
2016-02-09 22:00   ` Carlo Caione

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.