Skip to content

Commit 7cbf5ed

Browse files
dangowrtgregkh
authored andcommitted
serial: 8250_mtk: Enable baud clock and manage in runtime PM
commit d518314 upstream. 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 e32a83c ("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: e32a83c ("serial: 8250-mtk: modify mtk uart power and clock management") Fixes: b6c7ff2 ("serial: 8250_mtk: Simplify clock sequencing and runtime PM") Cc: stable <[email protected]> Reviewed-by: AngeloGioacchino Del Regno <[email protected]> Signed-off-by: Daniel Golle <[email protected]> Link: https://patch.msgid.link/de5197ccc31e1dab0965cabcc11ca92e67246cf6.1758058441.git.daniel@makrotopia.org Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 0bd9be0 commit 7cbf5ed

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

drivers/tty/serial/8250/8250_mtk.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -435,6 +435,7 @@ static int __maybe_unused mtk8250_runtime_suspend(struct device *dev)
435435
while
436436
(serial_in(up, MTK_UART_DEBUG0));
437437

438+
clk_disable_unprepare(data->uart_clk);
438439
clk_disable_unprepare(data->bus_clk);
439440

440441
return 0;
@@ -445,6 +446,7 @@ static int __maybe_unused mtk8250_runtime_resume(struct device *dev)
445446
struct mtk8250_data *data = dev_get_drvdata(dev);
446447

447448
clk_prepare_enable(data->bus_clk);
449+
clk_prepare_enable(data->uart_clk);
448450

449451
return 0;
450452
}
@@ -475,13 +477,13 @@ static int mtk8250_probe_of(struct platform_device *pdev, struct uart_port *p,
475477
int dmacnt;
476478
#endif
477479

478-
data->uart_clk = devm_clk_get(&pdev->dev, "baud");
480+
data->uart_clk = devm_clk_get_enabled(&pdev->dev, "baud");
479481
if (IS_ERR(data->uart_clk)) {
480482
/*
481483
* For compatibility with older device trees try unnamed
482484
* clk when no baud clk can be found.
483485
*/
484-
data->uart_clk = devm_clk_get(&pdev->dev, NULL);
486+
data->uart_clk = devm_clk_get_enabled(&pdev->dev, NULL);
485487
if (IS_ERR(data->uart_clk)) {
486488
dev_warn(&pdev->dev, "Can't get uart clock\n");
487489
return PTR_ERR(data->uart_clk);

0 commit comments

Comments
 (0)