From patchwork Wed Sep 30 12:08:26 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Ivan T. Ivanov" X-Patchwork-Id: 7297291 X-Patchwork-Delegate: agross@codeaurora.org Return-Path: X-Original-To: patchwork-linux-arm-msm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 5859A9F32B for ; Wed, 30 Sep 2015 12:09:27 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 151862066F for ; Wed, 30 Sep 2015 12:09:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id F2062206ED for ; Wed, 30 Sep 2015 12:09:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932702AbbI3MJQ (ORCPT ); Wed, 30 Sep 2015 08:09:16 -0400 Received: from mail-wi0-f169.google.com ([209.85.212.169]:33032 "EHLO mail-wi0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755820AbbI3MJF (ORCPT ); Wed, 30 Sep 2015 08:09:05 -0400 Received: by wiclk2 with SMTP id lk2so194772294wic.0 for ; Wed, 30 Sep 2015 05:09:04 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=iMh8vNYEAT7kFq+CYMI2iRIgVOjA/xYWyEHXhT6Yz1g=; b=RMHactJ0OR5l40Z8XGeqn6a0iU1kfvD2QxFi3RlCf8k6qZD+LIacjvntiCcqVwrn4c NT+8K/L1v7LDiqcmCXXDlqQULR25OmnB1aYf/KEuhUSXeVyx+C0iEB72TvQMH6yo+WeF c1esLzQK2DSjDapfJBhllP3XIvREAEHhk+/tqR0rKeLz7pcN+AGrdEqCefyAWyCuXke+ vW/ybUOVlCs1WstDAbJVfhaM2fUInhpyxuaHsXu1wec+zbZwVEnsuc74Y7xaN2THjhuS KVsd55AmxnbJOZ79CX1oYJXnpAdTjH5RyIaEMMIn3GPuzNlg4Rihz/MxGbiaGmbCL7MR 5r0Q== X-Gm-Message-State: ALoCoQlvFAWMy/7G+pFo1VYMND+oudkwZo7oH+N8Pebn9OvHtagg7eBNUXXQFJtvYaR6W6mUma8K X-Received: by 10.180.211.10 with SMTP id my10mr4594810wic.84.1443614944534; Wed, 30 Sep 2015 05:09:04 -0700 (PDT) Received: from localhost.localdomain ([37.157.136.206]) by smtp.googlemail.com with ESMTPSA id s1sm17032154wik.16.2015.09.30.05.09.03 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 30 Sep 2015 05:09:03 -0700 (PDT) From: "Ivan T. Ivanov" To: Andy Gross Cc: David Brown , Srinivas Kandagatla , Greg Kroah-Hartman , Jiri Slaby , Frank Rowand , Rob Herring , Pawel Moll , Mark Rutland , Ian Campbell , 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 Message-Id: <1443614906-2196-7-git-send-email-ivan.ivanov@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1443614906-2196-1-git-send-email-ivan.ivanov@linaro.org> References: <1443614906-2196-1-git-send-email-ivan.ivanov@linaro.org> Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP UART controller is capable to perform transfers up to 4 Mbps. Remove artificial 115.2 Kbps limitation. Signed-off-by: Ivan T. Ivanov --- drivers/tty/serial/msm_serial.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html 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);