From patchwork Fri Dec 22 22:11:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Christoph Niedermaier X-Patchwork-Id: 758041 Received: from mx3.securetransport.de (mx3.securetransport.de [116.203.31.6]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5712F2EAFE for ; Fri, 22 Dec 2023 22:13:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=dh-electronics.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=dh-electronics.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=dh-electronics.com header.i=@dh-electronics.com header.b="MOmpJC8r" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dh-electronics.com; s=dhelectronicscom; t=1703283149; bh=aatfAjsSNUO7y7Q9Wy1AUoT3DISwI/m0IEd0eo5O/3w=; h=From:To:CC:Subject:Date:From; b=MOmpJC8r+ae4DEp09PmzqQf6VA99+5xettRkl4RmSkkXXjQbPDdVbrWnibWKdBrKr m+5dYThDsrqW9yTyXUvqQls11wTtBzTFzMAZ3uLAIOLUowKQSRC9br2dt2OPhjfw4B xEixqSK8XFUsZiinWrmvaiYVZV4vLBJK0EVGWBDPyhNG50hSnDAW93g7aVPSATqq22 h0tbl95/md/Cunwp+wNKo+V/Jra+gWDLRZYBCX1UyuaxmEBGqaQfAZspmsLOV26ujd NPF99u6rW9rGgfN45a4wRVcyQE0WhIgkarg+dQUUdvMqEhwIdVqQyhunEeX89jc0EX rI6y7KwtZ6Azw== From: Christoph Niedermaier To: , CC: Christoph Niedermaier , "Greg Kroah-Hartman" , Jiri Slaby , Shawn Guo , Marek Vasut , Fabio Estevam , Sascha Hauer , Pengutronix Kernel Team , NXP Linux Team , Sergey Organov , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , "Rob Herring" , =?utf-8?q?Ilpo_J=C3=A4rvinen?= , Tom Rix , Thomas Gleixner , Lukas Wunner Subject: [PATCH] serial: imx: Ensure that imx_uart_rs485_config() is called with enabled clock Date: Fri, 22 Dec 2023 23:11:01 +0100 Message-ID: <20231222221101.2380-1-cniedermaier@dh-electronics.com> X-klartext: yes Precedence: bulk X-Mailing-List: linux-serial@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 There are register accesses in the function imx_uart_rs485_config(). The clock must be enabled for these accesses. This was ensured by calling it via the function uart_rs485_config() in the probe() function within the range where the clock is enabled. With the commit 7c7f9bc986e6 ("serial: Deassert Transmit Enable on probe in driver-specific way") it was removed from the probe() function and is now only called through the function uart_add_one_port() which is located at the end of the probe() function. But the clock is already switched off in this area. To ensure that the clock is enabled during register access, move the disabling of the clock to the very end of the probe() function. Fixes: 7c7f9bc986e6 ("serial: Deassert Transmit Enable on probe in driver-specific way") Signed-off-by: Christoph Niedermaier --- Cc: Greg Kroah-Hartman Cc: Jiri Slaby Cc: Shawn Guo Cc: Marek Vasut Cc: Fabio Estevam Cc: Sascha Hauer Cc: Pengutronix Kernel Team Cc: NXP Linux Team Cc: Sergey Organov Cc: "Uwe Kleine-König" Cc: Rob Herring Cc: "Ilpo Järvinen" Cc: Tom Rix Cc: Thomas Gleixner Cc: Lukas Wunner To: linux-serial@vger.kernel.org To: linux-arm-kernel@lists.infradead.org --- drivers/tty/serial/imx.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c index e7e952bb7bb8..2ec2e8a55884 100644 --- a/drivers/tty/serial/imx.c +++ b/drivers/tty/serial/imx.c @@ -2419,8 +2419,6 @@ static int imx_uart_probe(struct platform_device *pdev) imx_uart_writel(sport, ucr3, UCR3); } - clk_disable_unprepare(sport->clk_ipg); - hrtimer_init(&sport->trigger_start_tx, CLOCK_MONOTONIC, HRTIMER_MODE_REL); hrtimer_init(&sport->trigger_stop_tx, CLOCK_MONOTONIC, HRTIMER_MODE_REL); sport->trigger_start_tx.function = imx_trigger_start_tx; @@ -2467,7 +2465,11 @@ static int imx_uart_probe(struct platform_device *pdev) platform_set_drvdata(pdev, sport); - return uart_add_one_port(&imx_uart_uart_driver, &sport->port); + ret = uart_add_one_port(&imx_uart_uart_driver, &sport->port); + + clk_disable_unprepare(sport->clk_ipg); + + return ret; } static void imx_uart_remove(struct platform_device *pdev)