]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commit
clk: imx: Fix reparenting of UARTs not associated with stdout
authorAdam Ford <aford173@gmail.com>
Sat, 13 Mar 2021 12:28:17 +0000 (06:28 -0600)
committerKelsey Skunberg <kelsey.skunberg@canonical.com>
Mon, 24 May 2021 23:46:29 +0000 (17:46 -0600)
commit6eed68f3ca88637ca1aa87fad01267dee2342f86
treec7cea74aa5152e227ced6dde9e5d3cc905cd184a
parentbdf0dde1c9c1cafee40474293665680baef39b60
clk: imx: Fix reparenting of UARTs not associated with stdout

BugLink: https://bugs.launchpad.net/bugs/1929455
[ Upstream commit 379c9a24cc239000b1dec53db02fe17a86947423 ]

Most if not all i.MX SoC's call a function which enables all UARTS.
This is a problem for users who need to re-parent the clock source,
because any attempt to change the parent results in an busy error
due to the fact that the clocks have been enabled already.

  clk: failed to reparent uart1 to sys_pll1_80m: -16

Instead of pre-initializing all UARTS, scan the device tree to see
which UART clocks are associated to stdout, and only enable those
UART clocks if it's needed early.  This will move initialization of
the remaining clocks until after the parenting of the clocks.

When the clocks are shutdown, this mechanism will also disable any
clocks that were pre-initialized.

Fixes: 9461f7b33d11c ("clk: fix CLK_SET_RATE_GATE with clock rate protection")
Suggested-by: Aisheng Dong <aisheng.dong@nxp.com>
Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Abel Vesa <abel.vesa@nxp.com>
Tested-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Signed-off-by: Abel Vesa <abel.vesa@nxp.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Kelsey Skunberg <kelsey.skunberg@canonical.com>
16 files changed:
drivers/clk/imx/clk-imx25.c
drivers/clk/imx/clk-imx27.c
drivers/clk/imx/clk-imx35.c
drivers/clk/imx/clk-imx5.c
drivers/clk/imx/clk-imx6q.c
drivers/clk/imx/clk-imx6sl.c
drivers/clk/imx/clk-imx6sll.c
drivers/clk/imx/clk-imx6sx.c
drivers/clk/imx/clk-imx7d.c
drivers/clk/imx/clk-imx7ulp.c
drivers/clk/imx/clk-imx8mm.c
drivers/clk/imx/clk-imx8mn.c
drivers/clk/imx/clk-imx8mp.c
drivers/clk/imx/clk-imx8mq.c
drivers/clk/imx/clk.c
drivers/clk/imx/clk.h