clk: ti: clkctrl: Fix clkdm_clk handling [Linux 4.14.129]

clk: ti: clkctrl: Fix clkdm_clk handling [Linux 4.14.129]

This Linux kernel change "clk: ti: clkctrl: Fix clkdm_clk handling" is included in the Linux 4.14.129 release. This change is authored by Tony Lindgren <tony [at]> on Mon May 6 14:08:54 2019 -0700. The commit for this change in Linux stable tree is 535e73c (patch) which is from upstream commit 1cc5407. The same Linux upstream change may have been applied to various maintained Linux releases and you can find all Linux releases containing changes from upstream 1cc5407.

clk: ti: clkctrl: Fix clkdm_clk handling

[ Upstream commit 1cc54078d104f5b4d7e9f8d55362efa5a8daffdb ]

We need to always call clkdm_clk_enable() and clkdm_clk_disable() even
the clkctrl clock(s) enabled for the domain do not have any gate register
bits. Otherwise clockdomains may never get enabled except when devices get
probed with the legacy "ti,hwmods" devicetree property.

Fixes: 88a172526c32 ("clk: ti: add support for clkctrl clocks")
Signed-off-by: Tony Lindgren <[email protected]>
Signed-off-by: Stephen Boyd <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>

There are 8 lines of Linux source code added/deleted in this change. Code changes to Linux kernel are as follows.

 drivers/clk/ti/clkctrl.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/clk/ti/clkctrl.c b/drivers/clk/ti/clkctrl.c
index 53e71d0..82e4d5c 100644
--- a/drivers/clk/ti/clkctrl.c
+++ b/drivers/clk/ti/clkctrl.c
@@ -124,9 +124,6 @@ static int _omap4_clkctrl_clk_enable(struct clk_hw *hw)
    int ret;
    union omap4_timeout timeout = { 0 };

-   if (!clk->enable_bit)
-       return 0;
    if (clk->clkdm) {
        ret = ti_clk_ll_ops->clkdm_clk_enable(clk->clkdm, hw->clk);
        if (ret) {
@@ -138,6 +135,9 @@ static int _omap4_clkctrl_clk_enable(struct clk_hw *hw)

+   if (!clk->enable_bit)
+       return 0;
    val = ti_clk_ll_ops->clk_readl(&clk->enable_reg);

@@ -166,7 +166,7 @@ static void _omap4_clkctrl_clk_disable(struct clk_hw *hw)
    union omap4_timeout timeout = { 0 };

    if (!clk->enable_bit)
-       return;
+       goto exit;

    val = ti_clk_ll_ops->clk_readl(&clk->enable_reg);

Leave a Reply

Your email address will not be published. Required fields are marked *