devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Ivan T. Ivanov" <ivan.ivanov@linaro.org>
To: Andy Gross <agross@codeaurora.org>
Cc: David Brown <davidb@codeaurora.org>,
	Srinivas Kandagatla <srinivas.kandagatla@linaro.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Jiri Slaby <jslaby@suse.com>,
	Frank Rowand <frank.rowand@sonymobile.com>,
	Rob Herring <robh+dt@kernel.org>, Pawel Moll <pawel.moll@arm.com>,
	Mark Rutland <mark.rutland@arm.com>,
	Ian Campbell <ijc+devicetree@hellion.org.uk>,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-arm-msm@vger.kernel.org, linux-soc@vger.kernel.org,
	linux-serial@vger.kernel.org
Subject: [PATCH v2 6/6] tty: serial: msm: Remove 115.2 Kbps maximum baud rate limitation
Date: Wed, 30 Sep 2015 15:08:26 +0300	[thread overview]
Message-ID: <1443614906-2196-7-git-send-email-ivan.ivanov@linaro.org> (raw)
In-Reply-To: <1443614906-2196-1-git-send-email-ivan.ivanov@linaro.org>

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

  parent reply	other threads:[~2015-09-30 12:08 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-30 12:08 [PATCH v2 0/6] tty: serial: msm: Add DMA support and fix bit definitions Ivan T. Ivanov
2015-09-30 12:08 ` [PATCH v2 1/6] tty: serial: msm: Add mask value for UART_DM registers Ivan T. Ivanov
2015-09-30 12:08 ` [PATCH v2 2/6] tty: serial: msm: replaces (1 << x) with BIT(x) macro Ivan T. Ivanov
2015-09-30 12:08 ` [PATCH v2 3/6] tty: serial: msm: Add msm prefix to all driver functions Ivan T. Ivanov
2015-09-30 12:08 ` [PATCH v2 4/6] tty: serial: msm: Add TX DMA support Ivan T. Ivanov
2015-09-30 13:29   ` Mark Rutland
2015-09-30 13:51     ` Ivan T. Ivanov
2015-09-30 17:32       ` Mark Rutland
2015-09-30 20:24         ` Andy Gross
2015-09-30 12:08 ` [PATCH v2 5/6] tty: serial: msm: Add RX " Ivan T. Ivanov
2015-09-30 13:30   ` Mark Rutland
2015-09-30 12:08 ` Ivan T. Ivanov [this message]
     [not found] ` <1443614906-2196-1-git-send-email-ivan.ivanov-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2015-09-30 12:12   ` [PATCH v2 0/6] tty: serial: msm: Add DMA support and fix bit definitions Ivan T. Ivanov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1443614906-2196-7-git-send-email-ivan.ivanov@linaro.org \
    --to=ivan.ivanov@linaro.org \
    --cc=agross@codeaurora.org \
    --cc=davidb@codeaurora.org \
    --cc=devicetree@vger.kernel.org \
    --cc=frank.rowand@sonymobile.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=ijc+devicetree@hellion.org.uk \
    --cc=jslaby@suse.com \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=linux-soc@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=pawel.moll@arm.com \
    --cc=robh+dt@kernel.org \
    --cc=srinivas.kandagatla@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).