From: Eddie Huang <eddie.huang@mediatek.com>
To: Rob Herring <robh+dt@kernel.org>,
Matthias Brugger <matthias.bgg@gmail.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Pawel Moll <pawel.moll@arm.com>,
Mark Rutland <mark.rutland@arm.com>,
Ian Campbell <ijc+devicetree@hellion.org.uk>,
Kumar Gala <galak@codeaurora.org>,
Russell King <linux@arm.linux.org.uk>,
Jiri Slaby <jslaby@suse.cz>,
Eddie Huang <eddie.huang@mediatek.com>,
Alan Cox <alan@linux.intel.com>, <devicetree@vger.kernel.org>,
<linux-arm-kernel@lists.infradead.org>,
<linux-kernel@vger.kernel.org>, <linux-serial@vger.kernel.org>,
<yh.chen@mediatek.com>, <hc.yen@mediatek.com>,
<nathan.chung@mediatek.com>, <srv_heupstream@mediatek.com>,
Sascha Hauer <kernel@pengutronix.de>
Subject: [PATCH 1/3] tty: serial: Fix mediatek UART driver setting baudrate issue
Date: Wed, 22 Oct 2014 21:12:07 +0800 [thread overview]
Message-ID: <1413983529-21887-2-git-send-email-eddie.huang@mediatek.com> (raw)
In-Reply-To: <1413983529-21887-1-git-send-email-eddie.huang@mediatek.com>
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 <eddie.huang@mediatek.com>
---
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);
}
/*
--
1.8.1.1.dirty
next prev parent reply other threads:[~2014-10-22 13:17 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-22 13:12 [PATCH 0/3] tty: serial: Add mediatek MT8127 and MT8135 UART support Eddie Huang
2014-10-22 13:12 ` Eddie Huang [this message]
2014-10-22 13:12 ` [PATCH 2/3] ARM: mediatek: add UART dts for mt8127 and mt8135 Eddie Huang
2014-10-24 15:04 ` Matthias Brugger
2015-01-02 10:23 ` Matthias Brugger
2015-01-02 18:21 ` Matthias Brugger
2014-10-22 13:12 ` [PATCH 3/3] DTS: serial: Add bindings document for the Mediatek UARTs Eddie Huang
2015-01-02 10:24 ` Matthias Brugger
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=1413983529-21887-2-git-send-email-eddie.huang@mediatek.com \
--to=eddie.huang@mediatek.com \
--cc=alan@linux.intel.com \
--cc=devicetree@vger.kernel.org \
--cc=galak@codeaurora.org \
--cc=gregkh@linuxfoundation.org \
--cc=hc.yen@mediatek.com \
--cc=ijc+devicetree@hellion.org.uk \
--cc=jslaby@suse.cz \
--cc=kernel@pengutronix.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=linux@arm.linux.org.uk \
--cc=mark.rutland@arm.com \
--cc=matthias.bgg@gmail.com \
--cc=nathan.chung@mediatek.com \
--cc=pawel.moll@arm.com \
--cc=robh+dt@kernel.org \
--cc=srv_heupstream@mediatek.com \
--cc=yh.chen@mediatek.com \
/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
all inboxes | Powered by JetHome®