Skip to contentSkip to conversation

clk: Handle CLK_GET_RATE_NOCACHE flag in clk_set_rate()

PATCH New Sylwester Nawrocki 2 participants 3 messages Jun 21, 2013 – Jun 24, 2013 Common clk

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 clk: Handle CLK_GET_RATE_NOCACHE flag in clk_set_rate()

If a clock has CLK_GET_RATE_NOCACHE flag set the rate needs to be recalculated, rather than referencing the cached value.

Currently cached clk->rate is compared with new value to see if anything needs to be done in clk_set_rate(). This may cause required clock controller registers update to not happen when same clock frequency value is being set subsequently.

---
 drivers/clk/clk.c |    3 +++
 1 file changed, 3 insertions(+)
drivers/clk/clk.c +3 -0
index 1144e8c..ffa304e 100644
@@ -1215,6 +1215,9 @@ int clk_set_rate(struct clk *clk, unsigned long rate)
 	/* prevent racing with updates to the clock topology */
 	clk_prepare_lock();
 
+	if (clk->flags & CLK_GET_RATE_NOCACHE)
+		__clk_recalc_rates(clk, 0);
+
 	/* bail early if nothing to do */
 	if (rate == clk->rate)
 		goto out;

--
1.7.9.5

#1 lore raw

PATCH 1/1 clk: Handle CLK_GET_RATE_NOCACHE flag in clk_set_rate()

Quoting Sylwester Nawrocki (2013-06-21 06:07:35)

Quoted 10 lines

If a clock has CLK_GET_RATE_NOCACHE flag set the rate needs to be recalculated, rather than referencing the cached value.

Currently cached clk->rate is compared with new value to see if anything needs to be done in clk_set_rate(). This may cause required clock controller registers update to not happen when same clock frequency value is being set subsequently.

Peter already sent a patch for this:
https://git.linaro.org/gitweb?p=people/mturquette/linux.git;a=commitdiff;h=34e452a152efd25d654b7bc809df429337115b03

Regards,
Mike

Quoted 20 lines
---
 drivers/clk/clk.c |    3 +++
 1 file changed, 3 insertions(+)
drivers/clk/clk.c +3 -1
index 1144e8c..ffa304e 100644
@@ -1215,6 +1215,9 @@ int clk_set_rate(struct clk *clk, unsigned long rate)
        /* prevent racing with updates to the clock topology */
        clk_prepare_lock();
 
+       if (clk->flags & CLK_GET_RATE_NOCACHE)
+               __clk_recalc_rates(clk, 0);
+
        /* bail early if nothing to do */
        if (rate == clk->rate)
                goto out;
--

1.7.9.5

#2 lore raw
Quoted 9 lines · Mike Turquette

Quoting Sylwester Nawrocki (2013-06-21 06:07:35)

Quoted 8 lines
Quoted 8 lines

If a clock has CLK_GET_RATE_NOCACHE flag set the rate needs to be recalculated, rather than referencing the cached value.

Currently cached clk->rate is compared with new value to see if anything needs to be done in clk_set_rate(). This may cause required clock controller registers update to not happen when same clock frequency value is being set subsequently.

Quoted 5 lines
Quoted 2 lines
Quoted 2 lines

Peter already sent a patch for this:
https://git.linaro.org/gitweb?p=people/mturquette/linux.git;a=commitdiff;h=34e452a152efd25d654b7bc809df429337115b03

Thanks Mike, that also helps. My apologies for not having it noticed earlier. I'm going to post a patch for the Exynos clock driver, which adds missing CLK_GET_RATE_NOCACHE flags to the ISP clock group and would be really effective together with the above one.

Thanks,
Sylwester