From nobody Thu Oct 2 11:50:39 2025 Received: from pidgin.makrotopia.org (pidgin.makrotopia.org [185.142.180.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1AC0031BCAE; Tue, 16 Sep 2025 21:37:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.142.180.65 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758058676; cv=none; b=H1M3+B1pznRqgTsZSvA4EyztXTKgy9ENFFsVYQC/Mmf3hQAtWvqsl0W1cfKFwZwhcPiW9Gph1uYGLeDb5dvS1XjXOlFqFw7mGdvqYnou+kBiB0pjSnmw4+xKs86bdS2qSWjZaBzpfTu6ZklsxiPeZSi1WaEWwzFeyIizL0wNPyA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758058676; c=relaxed/simple; bh=3AZ0KeE/Qw0esnEUtKMTkPcociOMrHH2b80m+6xxFrU=; h=Date:From:To:Subject:Message-ID:MIME-Version:Content-Type: Content-Disposition; b=bJwm49i2KMIS2weKzo9djSa2YXPypq7KYS1KzROatrPH967NbphMb9CiWI9kuyfR82hzgEq5P4dGbw5J+f3eS6v2GWnmhy3/aZq7u0aXwAGoxvqRxZdJHJXrASzUxci00Sk/rzdGJbN6EziiM0XyeDO3Uw/cieSA6UKysOBjSlo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=makrotopia.org; spf=pass smtp.mailfrom=makrotopia.org; arc=none smtp.client-ip=185.142.180.65 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=makrotopia.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=makrotopia.org Received: from local by pidgin.makrotopia.org with esmtpsa (TLS1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.98.2) (envelope-from ) id 1uydMh-000000005cc-1stf; Tue, 16 Sep 2025 21:37:31 +0000 Date: Tue, 16 Sep 2025 22:37:27 +0100 From: Daniel Golle To: Greg Kroah-Hartman , Jiri Slaby , Matthias Brugger , AngeloGioacchino Del Regno , Daniel Golle , Yu Jiaoliang , Uwe =?iso-8859-1?Q?Kleine-K=F6nig?= , Andy Shevchenko , Changqi Hu , Sam Shih , Steven Liu , John Crispin , linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Subject: [PATCH v3] serial: 8250_mtk: Enable baud clock and manage in runtime PM Message-ID: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Some MediaTek SoCs got a gated UART baud clock, which currently gets disabled as the clk subsystem believes it would be unused. This results in the uart freezing right after "clk: Disabling unused clocks" on those platforms. Request the baud clock to be prepared and enabled during probe, and to restore run-time power management capabilities to what it was before commit e32a83c70cf9 ("serial: 8250-mtk: modify mtk uart power and clock management") disable and unprepare the baud clock when suspending the UART, prepare and enable it again when resuming it. Fixes: e32a83c70cf9 ("serial: 8250-mtk: modify mtk uart power and clock man= agement") Reviewed-by: AngeloGioacchino Del Regno Signed-off-by: Daniel Golle --- v3: squash into single patch v2: add managing run-time PM in dedicated patch drivers/tty/serial/8250/8250_mtk.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/tty/serial/8250/8250_mtk.c b/drivers/tty/serial/8250/8= 250_mtk.c index b44de2ed7413..5875a7b9b4b1 100644 --- a/drivers/tty/serial/8250/8250_mtk.c +++ b/drivers/tty/serial/8250/8250_mtk.c @@ -435,6 +435,7 @@ static int __maybe_unused mtk8250_runtime_suspend(struc= t device *dev) while (serial_in(up, MTK_UART_DEBUG0)); =20 + clk_disable_unprepare(data->uart_clk); clk_disable_unprepare(data->bus_clk); =20 return 0; @@ -445,6 +446,7 @@ static int __maybe_unused mtk8250_runtime_resume(struct= device *dev) struct mtk8250_data *data =3D dev_get_drvdata(dev); =20 clk_prepare_enable(data->bus_clk); + clk_prepare_enable(data->uart_clk); =20 return 0; } @@ -475,13 +477,13 @@ static int mtk8250_probe_of(struct platform_device *p= dev, struct uart_port *p, int dmacnt; #endif =20 - data->uart_clk =3D devm_clk_get(&pdev->dev, "baud"); + data->uart_clk =3D devm_clk_get_enabled(&pdev->dev, "baud"); if (IS_ERR(data->uart_clk)) { /* * For compatibility with older device trees try unnamed * clk when no baud clk can be found. */ - data->uart_clk =3D devm_clk_get(&pdev->dev, NULL); + data->uart_clk =3D devm_clk_get_enabled(&pdev->dev, NULL); if (IS_ERR(data->uart_clk)) { dev_warn(&pdev->dev, "Can't get uart clock\n"); return PTR_ERR(data->uart_clk); --=20 2.51.0