From patchwork Fri Jun 25 14:36:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Pali_Roh=C3=A1r?= X-Patchwork-Id: 12345445 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.6 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,UNWANTED_LANGUAGE_BODY,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B8585C2B9F4 for ; Fri, 25 Jun 2021 14:38:59 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7C06361969 for ; Fri, 25 Jun 2021 14:38:59 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7C06361969 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=fIQjpwJmn5jjB44emj+aNGIzFQUeS3gzIIQpsxjgiFE=; b=QgcsIJp+JigpQC U+CDUKln4e2N57aspK15ytItbdJO82yx2Q3dpkNui0f78VLABaF5hU9Qzw2XklyltF/n9AY55f1fj 1ORH58R4/1qVLH4dsAY42qB3IghJJJAMrMM3nNUb/dPy+ykEhB51a4OtgTWcrMOZtRJsh95FFgsIL 8nnoT4+8D4KhnlXoekziJ5xpw2ABjmoc/RJro+44joFsTi6KNaF0WhKYR9oUkPNmsCOTQYlyIb9Z/ 8r5fl8deNkIWzBBg5xgyrlYBKCXIFg4OHUIHeaC9qEuXzNnxt4O1zJdiYu9W6p42KdwJh1S36bw6S hYJwfrqEFXgpRCzjBxbw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1lwmx4-001y0v-4V; Fri, 25 Jun 2021 14:37:02 +0000 Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1lwmwz-001xym-Vc for linux-arm-kernel@lists.infradead.org; Fri, 25 Jun 2021 14:36:59 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 2B46361963; Fri, 25 Jun 2021 14:36:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1624631817; bh=P00gi1Wtx+KpLLM7s98I0ogOiO2aXZ3GHASm7R/VtvA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mKseQSOcV9prIj+yP/LdEb+uUHmS2u2OaqMWk6fyxO6U+yWF2mhF/f4BDak86EIqS YRkTBuDSkPC5WBwlUMgGLqtEhxj6ziLQ35yzgo8KTxe15BitQI7NqEo0R6t5xczww/ bAgwl4TW6uGHYPUOB2FZolH+kjDbeXmH4TgXf+mU23Lq85xJmh4YsQjA7vPEtyuTp/ lMcnUC2QAJ73Oo6q3ZXd7tWkeO+mi1ZcIdFYDG9YeQNZBnhWTeNxVP8ZTUVHyzGVzL gEVrQo+D3gPC+PJRgwGYN0Q9k+pUxH39e9cY+yPdwG2NZBTaSJbMA6LlNjh8hHMI1J 79KXONpAwsP1Q== Received: by pali.im (Postfix) id 5ACC9A7D; Fri, 25 Jun 2021 16:36:55 +0200 (CEST) From: =?utf-8?q?Pali_Roh=C3=A1r?= To: Michael Turquette , Stephen Boyd , Rob Herring , Greg Kroah-Hartman Cc: Andrew Lunn , Gregory Clement , Sebastian Hesselbarth , Vladimir Vid , =?utf-8?q?Marek_Beh=C3=BAn?= , Geert Uytterhoeven , linux-clk@vger.kernel.org, linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v2 01/11] serial: mvebu-uart: fix calculation of clock divisor Date: Fri, 25 Jun 2021 16:36:07 +0200 Message-Id: <20210625143617.12826-2-pali@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210625143617.12826-1-pali@kernel.org> References: <20210624224909.6350-1-pali@kernel.org> <20210625143617.12826-1-pali@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210625_073658_077578_914200B2 X-CRM114-Status: GOOD ( 11.67 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The clock divisor should be rounded to the closest value. Signed-off-by: Pali Rohár Fixes: 68a0db1d7da2 ("serial: mvebu-uart: add function to change baudrate") Cc: stable@vger.kernel.org # 0e4cf69ede87 ("serial: mvebu-uart: clarify the baud rate derivation") --- drivers/tty/serial/mvebu-uart.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/tty/serial/mvebu-uart.c b/drivers/tty/serial/mvebu-uart.c index e0c00a1b0763..f81bfdaa608c 100644 --- a/drivers/tty/serial/mvebu-uart.c +++ b/drivers/tty/serial/mvebu-uart.c @@ -463,7 +463,7 @@ static int mvebu_uart_baud_rate_set(struct uart_port *port, unsigned int baud) * makes use of D to configure the desired baudrate. */ m_divisor = OSAMP_DEFAULT_DIVISOR; - d_divisor = DIV_ROUND_UP(port->uartclk, baud * m_divisor); + d_divisor = DIV_ROUND_CLOSEST(port->uartclk, baud * m_divisor); brdv = readl(port->membase + UART_BRDV); brdv &= ~BRDV_BAUD_MASK;