Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1236224

[PATCH v2 6/6] tty: serial: msm: Remove 115.2 Kbps maximum baud rate limitation

From "Ivan T. Ivanov" <ivan.ivanov@linaro.org>
Newsgroups linux.kernel
Subject [PATCH v2 6/6] tty: serial: msm: Remove 115.2 Kbps maximum baud rate limitation
Date 2015-09-30 14:10 +0200
Message-ID <qeomT-4wT-27@gated-at.bofh.it> (permalink)
References <qeomS-4wT-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


UART controller is capable to perform transfers up to 4 Mbps.
Remove artificial 115.2 Kbps limitation.

Signed-off-by: Ivan T. Ivanov <ivan.ivanov@linaro.org>
---
 drivers/tty/serial/msm_serial.c | 20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)

diff --git a/drivers/tty/serial/msm_serial.c b/drivers/tty/serial/msm_serial.c
index fc5f6b3b4bbb..abeb35555d93 100644
--- a/drivers/tty/serial/msm_serial.c
+++ b/drivers/tty/serial/msm_serial.c
@@ -882,6 +882,7 @@ msm_find_best_baud(struct uart_port *port, unsigned int baud)
 		{    3, 0xdd,  8 },
 		{    2, 0xee, 16 },
 		{    1, 0xff, 31 },
+		{    0, 0xff, 31 },
 	};

 	divisor = uart_get_divisor(port, baud);
@@ -893,16 +894,29 @@ msm_find_best_baud(struct uart_port *port, unsigned int baud)
 	return entry; /* Default to smallest divider */
 }

-static int msm_set_baud_rate(struct uart_port *port, unsigned int baud)
+static int msm_set_baud_rate(struct uart_port *port, unsigned int baud,
+			     unsigned long *saved_flags)
 {
 	unsigned int rxstale, watermark, mask;
 	struct msm_port *msm_port = UART_TO_MSM(port);
 	const struct msm_baud_map *entry;
+	unsigned long flags;

 	entry = msm_find_best_baud(port, baud);

 	msm_write(port, entry->code, UART_CSR);

+	if (baud > 460800)
+		port->uartclk = baud * 16;
+
+	flags = *saved_flags;
+	spin_unlock_irqrestore(&port->lock, flags);
+
+	clk_set_rate(msm_port->clk, port->uartclk);
+
+	spin_lock_irqsave(&port->lock, flags);
+	*saved_flags = flags;
+
 	/* RX stale watermark */
 	rxstale = entry->rxstale;
 	watermark = UART_IPR_STALE_LSB & rxstale;
@@ -1026,8 +1040,8 @@ static void msm_set_termios(struct uart_port *port, struct ktermios *termios,
 		msm_stop_dma(port, dma);

 	/* calculate and set baud rate */
-	baud = uart_get_baud_rate(port, termios, old, 300, 115200);
-	baud = msm_set_baud_rate(port, baud);
+	baud = uart_get_baud_rate(port, termios, old, 300, 4000000);
+	baud = msm_set_baud_rate(port, baud, &flags);
 	if (tty_termios_baud_rate(termios))
 		tty_termios_encode_baud_rate(termios, baud, baud);

--
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v2 0/6] tty: serial: msm: Add DMA support and fix bit definitions "Ivan T. Ivanov" <ivan.ivanov@linaro.org> - 2015-09-30 14:10 +0200
  [PATCH v2 1/6] tty: serial: msm: Add mask value for UART_DM registers "Ivan T. Ivanov" <ivan.ivanov@linaro.org> - 2015-09-30 14:10 +0200
  [PATCH v2 6/6] tty: serial: msm: Remove 115.2 Kbps maximum baud rate limitation "Ivan T. Ivanov" <ivan.ivanov@linaro.org> - 2015-09-30 14:10 +0200
  [PATCH v2 3/6] tty: serial: msm: Add msm prefix to all driver functions "Ivan T. Ivanov" <ivan.ivanov@linaro.org> - 2015-09-30 14:20 +0200
  [PATCH v2 5/6] tty: serial: msm: Add RX DMA support "Ivan T. Ivanov" <ivan.ivanov@linaro.org> - 2015-09-30 14:20 +0200
    Re: [PATCH v2 5/6] tty: serial: msm: Add RX DMA support Mark Rutland <mark.rutland@arm.com> - 2015-09-30 15:40 +0200
  [PATCH v2 2/6] tty: serial: msm: replaces (1 << x) with BIT(x) macro "Ivan T. Ivanov" <ivan.ivanov@linaro.org> - 2015-09-30 14:20 +0200
  Re: [PATCH v2 0/6] tty: serial: msm: Add DMA support and fix bit  definitions "Ivan T. Ivanov" <iivanov.xz@gmail.com> - 2015-09-30 14:20 +0200

csiph-web