linux-serial.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 3/3] serial: pl011: allow very high baudrates
@ 2012-09-20  9:46 Linus Walleij
  2012-09-20 19:00 ` Russell King - ARM Linux
  0 siblings, 1 reply; 18+ messages in thread
From: Linus Walleij @ 2012-09-20  9:46 UTC (permalink / raw)
  To: linux-serial, Greg Kroah-Hartman
  Cc: Linus Walleij, Guillaume Jaunet, Par-Gunnar Hjalmdahl,
	Anmar Oueja, Matthias Locher, Rajanikanth H.V, Christophe Arnal,
	linux-arm-kernel

From: Linus Walleij <linus.walleij@linaro.org>

The ST Microelectronics variant of the PL011 is capable of supporting
very high non-standard baud rates, even above 4 Mbps. However the
uart_get_baud_rate() will not allow us to set these, so override that
calculation on very high speeds.

Cc: Par-Gunnar Hjalmdahl <par-gunnar.hjalmdahl@stericsson.com>
Signed-off-by: Guillaume Jaunet <guillaume.jaunet@stericsson.com>
Signed-off-by: Christophe Arnal <christophe.arnal@stericsson.com>
Signed-off-by: Matthias Locher <matthias.locher@stericsson.com>
Signed-off-by: Rajanikanth H.V <rajanikanth.hv@stericsson.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
 drivers/tty/serial/amba-pl011.c | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c
index 32240a7..8ac1a42 100644
--- a/drivers/tty/serial/amba-pl011.c
+++ b/drivers/tty/serial/amba-pl011.c
@@ -1507,10 +1507,19 @@ pl011_set_termios(struct uart_port *port, struct ktermios *termios,
 	}
 
 	/*
-	 * Ask the core to calculate the divisor for us.
+	 * Override baud calculation for very high non-standard baudrates
+	 * on the ST Micro oversampling variant. This must override the
+	 * uart_get_baud_rate() call, because this function changes
+	 * baudrate to the default on these baudrates.
 	 */
-	baud = uart_get_baud_rate(port, termios, old, 0,
-				  max_baud);
+	if (uap->vendor->oversampling &&
+	    ((termios->c_ispeed > 4000000) ||
+	     (termios->c_ospeed > 4000000)))
+		baud = termios->c_ispeed;
+	else
+		/* Ask the core to calculate the divisor for us. */
+		baud = uart_get_baud_rate(port, termios, old, 0,
+					  max_baud);
 
 	if (baud > port->uartclk/16)
 		quot = DIV_ROUND_CLOSEST(port->uartclk * 8, baud);
-- 
1.7.11.3

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

end of thread, other threads:[~2012-09-26 10:00 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-20  9:46 [PATCH 3/3] serial: pl011: allow very high baudrates Linus Walleij
2012-09-20 19:00 ` Russell King - ARM Linux
2012-09-21 13:41   ` Linus Walleij
2012-09-21 14:37     ` Alan Cox
2012-09-21 14:58       ` Russell King - ARM Linux
2012-09-21 15:05         ` Alan Cox
2012-09-21 15:06           ` Russell King - ARM Linux
2012-09-21 15:36             ` Alan Cox
2012-09-21 15:14     ` Alan Cox
2012-09-21 15:25     ` Alan Cox
2012-09-21 17:52       ` Linus Walleij
2012-09-21 19:56         ` Alan Cox
2012-09-21 20:34           ` Russell King - ARM Linux
2012-09-21 20:55             ` Alan Cox
2012-09-25 18:48           ` Linus Walleij
2012-09-25 19:00             ` Alan Cox
2012-09-26  8:06             ` Linus Walleij
2012-09-26 10:04               ` Alan Cox

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).