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: 11526 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 5BEEA23E41 for ; Thu, 20 Sep 2012 09:46:37 +0000 (UTC) Received: from mail-ie0-f180.google.com (mail-ie0-f180.google.com [209.85.223.180]) by fiordland.canonical.com (Postfix) with ESMTP id 1FD7A3D09BDA for ; Thu, 20 Sep 2012 09:46:22 +0000 (UTC) Received: by mail-ie0-f180.google.com with SMTP id e10so2545757iej.11 for ; Thu, 20 Sep 2012 02:46:22 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:from:to:cc :subject:date:message-id:x-mailer:mime-version:content-type :x-gm-message-state; bh=/jMJY2MFEz32zn6Y5s/NALADY55dvfjwg15WtEDTEvk=; b=LdcXJIvJ3t9TrP4ZVH7AEx3OHAX58b1nAYgwOSUdfKWtChWwloDhdHlsYw96tXMj/R TcmlmDbYKdDMCcRmmGbFLfxaWEx3UnWzSdsR9mEm8NAMt2Vlpcf7D+fi920KNYkU5d3Z a0nqN7MeF2J+Fy6h0JpxQWFfCegtpg1HkofNpzk+BtBpJftEv41YGRdKc5hCy96Nm4Ix xIsQ4OoPDB7OjnUskZHGeIVbi51CXFFnxSvGFMWJFF3zQdVcEX3GXXixdnEn99bccIQJ qyIhLZXBtmpLfK9NHJY/ztNbMcyxkxOUZ0tuvcOuX/7uln83YQPUo7BDJkmyDYvZehUk LZUA== Received: by 10.50.195.134 with SMTP id ie6mr1150174igc.28.1348134382713; Thu, 20 Sep 2012 02:46:22 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.50.184.232 with SMTP id ex8csp65949igc; Thu, 20 Sep 2012 02:46:22 -0700 (PDT) Received: by 10.14.193.136 with SMTP id k8mr1497035een.9.1348134381555; Thu, 20 Sep 2012 02:46:21 -0700 (PDT) Received: from eu1sys200aog102.obsmtp.com (eu1sys200aog102.obsmtp.com [207.126.144.113]) by mx.google.com with SMTP id v43si2158867een.36.2012.09.20.02.46.16 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 20 Sep 2012 02:46:21 -0700 (PDT) Received-SPF: neutral (google.com: 207.126.144.113 is neither permitted nor denied by best guess record for domain of linus.walleij@stericsson.com) client-ip=207.126.144.113; Authentication-Results: mx.google.com; spf=neutral (google.com: 207.126.144.113 is neither permitted nor denied by best guess record for domain of linus.walleij@stericsson.com) smtp.mail=linus.walleij@stericsson.com 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 Cc: , Anmar Oueja , Linus Walleij , Par-Gunnar Hjalmdahl , Guillaume Jaunet , Christophe Arnal , Matthias Locher , Rajanikanth H.V 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-Gm-Message-State: ALoCoQn+zTmhlQLF75OIbM02fhm3m1vsuFw/QE7kfNz7l9Gb+SqPQ9ruKzjuOCQTpQi96Ilf1Nbn 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);