From patchwork Thu Sep 20 09:46:08 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 1483501 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork2.kernel.org (Postfix) with ESMTP id 92578DF2D2 for ; Thu, 20 Sep 2012 09:48:20 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TEdLD-0007RO-IF; Thu, 20 Sep 2012 09:46:39 +0000 Received: from eu1sys200aog102.obsmtp.com ([207.126.144.113]) by merlin.infradead.org with smtps (Exim 4.76 #1 (Red Hat Linux)) id 1TEdKv-0007Pg-JG for linux-arm-kernel@lists.infradead.org; Thu, 20 Sep 2012 09:46:24 +0000 Received: from beta.dmz-eu.st.com ([164.129.1.35]) (using TLSv1) by eu1sys200aob102.postini.com ([207.126.147.11]) with SMTP ID DSNKUFrl6Met/rCgJvlS8J5bq8vA+Avkszgg@postini.com; Thu, 20 Sep 2012 09:46:21 UTC Received: from zeta.dmz-eu.st.com (zeta.dmz-eu.st.com [164.129.230.9]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id B91ED317; Thu, 20 Sep 2012 09:46:14 +0000 (GMT) Received: from relay2.stm.gmessaging.net (unknown [10.230.100.18]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 724F92767; Thu, 20 Sep 2012 09:46:14 +0000 (GMT) Received: from exdcvycastm003.EQ1STM.local (alteon-source-exch [10.230.100.61]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (Client CN "exdcvycastm003", Issuer "exdcvycastm003" (not verified)) by relay2.stm.gmessaging.net (Postfix) with ESMTPS id E6D16A807E; Thu, 20 Sep 2012 11:46:09 +0200 (CEST) Received: from steludxu4075.lud.stericsson.com (10.230.100.153) by smtp.stericsson.com (10.230.100.1) with Microsoft SMTP Server (TLS) id 8.3.83.0; Thu, 20 Sep 2012 11:46:13 +0200 From: Linus Walleij To: , Greg Kroah-Hartman Subject: [PATCH 3/3] serial: pl011: allow very high baudrates Date: Thu, 20 Sep 2012 11:46:08 +0200 Message-ID: <1348134368-25663-1-git-send-email-linus.walleij@stericsson.com> X-Mailer: git-send-email 1.7.11.3 MIME-Version: 1.0 X-Spam-Note: CRM114 invocation failed X-Spam-Score: -4.2 (----) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-4.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at http://www.dnswl.org/, medium trust [207.126.144.113 listed in list.dnswl.org] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: Linus Walleij , Guillaume Jaunet , Par-Gunnar Hjalmdahl , Anmar Oueja , Matthias Locher , "Rajanikanth H.V" , Christophe Arnal , linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Linus Walleij 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 Signed-off-by: Guillaume Jaunet Signed-off-by: Christophe Arnal Signed-off-by: Matthias Locher Signed-off-by: Rajanikanth H.V Signed-off-by: Linus Walleij --- 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);