Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

serial: 8250_mtk: Enable baud clock and manage in runtime PM

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 management")
Fixes: b6c7ff2693ddc ("serial: 8250_mtk: Simplify clock sequencing and runtime PM")
Cc: stable <stable@kernel.org>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
Link: https://patch.msgid.link/de5197ccc31e1dab0965cabcc11ca92e67246cf6.1758058441.git.daniel@makrotopia.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Daniel Golle and committed by
Greg Kroah-Hartman
d518314a daeb4037

+4 -2
+4 -2
drivers/tty/serial/8250/8250_mtk.c
··· 435 435 while 436 436 (serial_in(up, MTK_UART_DEBUG0)); 437 437 438 + clk_disable_unprepare(data->uart_clk); 438 439 clk_disable_unprepare(data->bus_clk); 439 440 440 441 return 0; ··· 446 445 struct mtk8250_data *data = dev_get_drvdata(dev); 447 446 448 447 clk_prepare_enable(data->bus_clk); 448 + clk_prepare_enable(data->uart_clk); 449 449 450 450 return 0; 451 451 } ··· 477 475 int dmacnt; 478 476 #endif 479 477 480 - data->uart_clk = devm_clk_get(&pdev->dev, "baud"); 478 + data->uart_clk = devm_clk_get_enabled(&pdev->dev, "baud"); 481 479 if (IS_ERR(data->uart_clk)) { 482 480 /* 483 481 * For compatibility with older device trees try unnamed 484 482 * clk when no baud clk can be found. 485 483 */ 486 - data->uart_clk = devm_clk_get(&pdev->dev, NULL); 484 + data->uart_clk = devm_clk_get_enabled(&pdev->dev, NULL); 487 485 if (IS_ERR(data->uart_clk)) { 488 486 dev_warn(&pdev->dev, "Can't get uart clock\n"); 489 487 return PTR_ERR(data->uart_clk);