Message ID | 20210625143617.12826-3-pali@kernel.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show
Return-Path: <SRS0=wsnO=LT=lists.infradead.org=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@kernel.org> 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=-17.4 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,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 6E816C2B9F4 for <linux-arm-kernel@archiver.kernel.org>; Fri, 25 Jun 2021 14:39:21 +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 3C4D56195F for <linux-arm-kernel@archiver.kernel.org>; Fri, 25 Jun 2021 14:39:21 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3C4D56195F 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=p1zOTTwn58A7dm7HUa2/C3OhQM4ihAyGPkKM/Vnr6vc=; b=IXDaqhf1/LeBd4 eXm7H+Zvwq0R+vxAQVxtfca8EzvQrsrVLRbcQhChyIP+eGayEEprG8nQwbGaXNK9xxbj9PTiyawT3 GXyeQesFwjc5fh1KlcmxpnyxwYhDaO/k/6Ia/c9vDegzT8kpsR+JutkdpB503wVsoHqL6IuHhtge5 l5xDxDMLXdWS5+bW2Bcs5q7mSfjCaO6VNVWUeU6MQrwyZG3u3G4GJ7Jnj8SKzwsGVkxBrhciD/4Ki +bRHjLyv08d61qKP3QV9LAPPxa/9F8hnuCcqLIUB1orAfcHTBp7A9jeKAxkaRRcaF4JnkJVuMj68D R7qX23+78X+rgZWR02sQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1lwmxc-001y9k-8F; Fri, 25 Jun 2021 14:37:36 +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 1lwmx0-001xzW-Lt for linux-arm-kernel@lists.infradead.org; Fri, 25 Jun 2021 14:37:00 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 3D6156197D; Fri, 25 Jun 2021 14:36:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1624631818; bh=TY3iBQKER6Z5ph8zWEWZU/pK1GZsZOyt08z1Cvndgwk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tFH2krxAUdnVo2o1eH28xZYBc+sPvoHTPUDNA/jnWE6HQ3sGHzClSguGJVlf4gFnh 7cT6uTLphBArfn1ryGI2KxEyFbTTvtmSAp04YCzckbv0oxSeawYzYq9GWWx3Ku9RY2 NitMEtgrlzzP3mLKe2RGhgy5+x10fMLInO6J8i4NFY+aWcS9SnvbBbu+UxSHAtVDU4 jGtsVy3ZWf+2VX9TCAFJL7vzw54U/rHXou84km2DrwGygTCtDQgO6p+DrWfA9v07Ln GZrpJTnnsmWFrHQ3hOjhcEKQGDMPe5bOk638elEkePEHtUO06NCnRKXMxfNNcGl4ho Rc5G3vV5XmFOA== Received: by pali.im (Postfix) id 64A02A89; Fri, 25 Jun 2021 16:36:56 +0200 (CEST) From: =?utf-8?q?Pali_Roh=C3=A1r?= <pali@kernel.org> To: Michael Turquette <mturquette@baylibre.com>, Stephen Boyd <sboyd@kernel.org>, Rob Herring <robh+dt@kernel.org>, Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: Andrew Lunn <andrew@lunn.ch>, Gregory Clement <gregory.clement@bootlin.com>, Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>, Vladimir Vid <vladimir.vid@sartura.hr>, =?utf-8?q?Marek_Beh=C3=BAn?= <kabel@kernel.org>, Geert Uytterhoeven <geert@linux-m68k.org>, linux-clk@vger.kernel.org, linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v2 02/11] serial: mvebu-uart: do not allow changing baudrate when uartclk is not available Date: Fri, 25 Jun 2021 16:36:08 +0200 Message-Id: <20210625143617.12826-3-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_772079_AC69381E X-CRM114-Status: GOOD ( 14.31 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: <linux-arm-kernel.lists.infradead.org> List-Unsubscribe: <http://lists.infradead.org/mailman/options/linux-arm-kernel>, <mailto:linux-arm-kernel-request@lists.infradead.org?subject=unsubscribe> List-Archive: <http://lists.infradead.org/pipermail/linux-arm-kernel/> List-Post: <mailto:linux-arm-kernel@lists.infradead.org> List-Help: <mailto:linux-arm-kernel-request@lists.infradead.org?subject=help> List-Subscribe: <http://lists.infradead.org/mailman/listinfo/linux-arm-kernel>, <mailto:linux-arm-kernel-request@lists.infradead.org?subject=subscribe> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: base64 Sender: "linux-arm-kernel" <linux-arm-kernel-bounces@lists.infradead.org> Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org |
Series |
[v2,01/11] serial: mvebu-uart: fix calculation of clock divisor
|
expand
|
diff --git a/drivers/tty/serial/mvebu-uart.c b/drivers/tty/serial/mvebu-uart.c index f81bfdaa608c..dc0c26824ddb 100644 --- a/drivers/tty/serial/mvebu-uart.c +++ b/drivers/tty/serial/mvebu-uart.c @@ -445,12 +445,11 @@ static void mvebu_uart_shutdown(struct uart_port *port) static int mvebu_uart_baud_rate_set(struct uart_port *port, unsigned int baud) { - struct mvebu_uart *mvuart = to_mvuart(port); unsigned int d_divisor, m_divisor; u32 brdv, osamp; - if (IS_ERR(mvuart->clk)) - return -PTR_ERR(mvuart->clk); + if (!port->uartclk) + return -EOPNOTSUPP; /* * The baudrate is derived from the UART clock thanks to two divisors:
Testing mvuart->clk for non-error is not enough as mvuart->clk may contain valid clk pointer but when clk_prepare_enable(mvuart->clk) failed then port->uartclk is zero. When mvuart->clk is not available then port->uartclk is zero too. Parent clock rate port->uartclk is needed to calculate UART clock divisor and without it is not possible to change baudrate. So fix test condition when it is possible to change baudrate. Signed-off-by: Pali Rohár <pali@kernel.org> Fixes: 68a0db1d7da2 ("serial: mvebu-uart: add function to change baudrate") --- drivers/tty/serial/mvebu-uart.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)