From patchwork Wed Oct 22 13:12:07 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?RWRkaWUgSHVhbmcgKOm7g+aZuuWCkSk=?= X-Patchwork-Id: 39289 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f72.google.com (mail-wg0-f72.google.com [74.125.82.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id A7F9C202DB for ; Wed, 22 Oct 2014 13:15:10 +0000 (UTC) Received: by mail-wg0-f72.google.com with SMTP id m15sf2062979wgh.3 for ; Wed, 22 Oct 2014 06:15:09 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:subject:date:message-id :in-reply-to:references:mime-version:cc:precedence:list-id :list-unsubscribe:list-archive:list-post:list-help:list-subscribe :sender:errors-to:x-original-sender :x-original-authentication-results:mailing-list:content-type :content-transfer-encoding; bh=xlDmvHuvMNmZvlYZ8KUganfAHnleJY6RqYgX1sGYiqg=; b=UDNod5MaR0lm8yzdehZL7TI/Clgy5pW5CIGZj4aCUhtILanBU9YRTYisfbUPeJGfQK aUZHyk9QUn5ndl3c16jQCvEVLq0ovjEHlUam1zM843sBvj91Ob45M6RPCXnTjs9OGni9 Olaf1lXVWY26ls+86VD+q2RjZ50Ho7mw0HtRMySjPMuaJUXOAhqIHgsVvRx7mlIUl9VJ K5XYzI3UAPf/Z5pwmLs9pAMC2ar4+x9L5yingoUhiAGcivbjL587JoH3lkuhZsa7sz+Z XP04EWiyA/jpGdIkMts4Y7bjJc0O12YQSGXmvo2KtZvsA9eP8daQjJw9ydXgdCjQVs/3 9gTQ== X-Gm-Message-State: ALoCoQleURN5XiuUlEbKeJ/degWuvolv20esz3aI3nfibSNBZXS0gFn2iKZVSIXRwQl3hU3LsRMV X-Received: by 10.152.21.170 with SMTP id w10mr483431lae.6.1413983709862; Wed, 22 Oct 2014 06:15:09 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.203.167 with SMTP id kr7ls186449lac.94.gmail; Wed, 22 Oct 2014 06:15:09 -0700 (PDT) X-Received: by 10.152.27.134 with SMTP id t6mr41372637lag.17.1413983709580; Wed, 22 Oct 2014 06:15:09 -0700 (PDT) Received: from mail-lb0-f174.google.com (mail-lb0-f174.google.com. [209.85.217.174]) by mx.google.com with ESMTPS id uc5si23335597lbb.31.2014.10.22.06.15.09 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 22 Oct 2014 06:15:09 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.174 as permitted sender) client-ip=209.85.217.174; Received: by mail-lb0-f174.google.com with SMTP id p9so2777986lbv.5 for ; Wed, 22 Oct 2014 06:15:09 -0700 (PDT) X-Received: by 10.112.77.74 with SMTP id q10mr33048896lbw.66.1413983709498; Wed, 22 Oct 2014 06:15:09 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.84.229 with SMTP id c5csp68370lbz; Wed, 22 Oct 2014 06:15:08 -0700 (PDT) X-Received: by 10.70.89.68 with SMTP id bm4mr1270282pdb.169.1413983707970; Wed, 22 Oct 2014 06:15:07 -0700 (PDT) Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id cc12si14145364pdb.189.2014.10.22.06.15.07 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 22 Oct 2014 06:15:07 -0700 (PDT) Received-SPF: none (google.com: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org does not designate permitted sender hosts) client-ip=2001:1868:205::9; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1XgvjA-0001pT-To; Wed, 22 Oct 2014 13:13:24 +0000 Received: from [210.61.82.183] (helo=mailgw01.mediatek.com) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Xgvit-0001hS-W7 for linux-arm-kernel@lists.infradead.org; Wed, 22 Oct 2014 13:13:08 +0000 X-Listener-Flag: 11101 Received: from mtkhts07.mediatek.inc [(172.21.101.69)] by mailgw01.mediatek.com (envelope-from ) (mhqrelay.mediatek.com ESMTP with TLS) with ESMTP id 1849655804; Wed, 22 Oct 2014 21:12:40 +0800 Received: from mtkslt208.mediatek.inc (10.21.15.95) by mtkhts07.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 14.3.181.6; Wed, 22 Oct 2014 21:12:40 +0800 From: Eddie Huang To: Rob Herring , Matthias Brugger , Greg Kroah-Hartman Subject: [PATCH 1/3] tty: serial: Fix mediatek UART driver setting baudrate issue Date: Wed, 22 Oct 2014 21:12:07 +0800 Message-ID: <1413983529-21887-2-git-send-email-eddie.huang@mediatek.com> X-Mailer: git-send-email 1.8.1.1.dirty In-Reply-To: <1413983529-21887-1-git-send-email-eddie.huang@mediatek.com> References: <1413983529-21887-1-git-send-email-eddie.huang@mediatek.com> MIME-Version: 1.0 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20141022_061308_335977_7E70C793 X-CRM114-Status: UNSURE ( 8.76 ) X-CRM114-Notice: Please train this message. X-Spam-Score: 1.3 (+) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (1.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 UNPARSEABLE_RELAY Informational: message has unparseable relay lines 1.3 RDNS_NONE Delivered to internal network by a host with no rDNS Cc: Mark Rutland , devicetree@vger.kernel.org, Russell King , srv_heupstream@mediatek.com, Pawel Moll , Ian Campbell , hc.yen@mediatek.com, yh.chen@mediatek.com, linux-kernel@vger.kernel.org, nathan.chung@mediatek.com, linux-serial@vger.kernel.org, Kumar Gala , Eddie Huang , Jiri Slaby , Sascha Hauer , linux-arm-kernel@lists.infradead.org, Alan Cox X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: eddie.huang@mediatek.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.174 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 In mtk8250_set_termios function, calculating quot value can not be zero, otherwise, using DIV_ROUND_CLOSEST(port->uartclk, quot * baud) will fail due to divisor is zero. Signed-off-by: Eddie Huang --- drivers/tty/serial/8250/8250_mtk.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/tty/serial/8250/8250_mtk.c b/drivers/tty/serial/8250/8250_mtk.c index 8f37d57..6f93123 100644 --- a/drivers/tty/serial/8250/8250_mtk.c +++ b/drivers/tty/serial/8250/8250_mtk.c @@ -74,14 +74,14 @@ mtk8250_set_termios(struct uart_port *port, struct ktermios *termios, /* Set to next lower baudrate supported */ if ((baud == 500000) || (baud == 576000)) baud = 460800; - quot = DIV_ROUND_CLOSEST(port->uartclk, 4 * baud); + quot = DIV_ROUND_UP(port->uartclk, 4 * baud); } else { serial_port_out(port, UART_MTK_HIGHS, 0x3); /* Set to highest baudrate supported */ if (baud >= 1152000) baud = 921600; - quot = DIV_ROUND_CLOSEST(port->uartclk, 256 * baud); + quot = DIV_ROUND_UP(port->uartclk, 256 * baud); } /*