Skip to content

Commit c9d1b58

Browse files
committed
clk: renesas: div6: Switch to .determine_rate()
As the .round_rate() callback returns a long clock rate, it cannot return clock rates that do not fit in signed long, but do fit in unsigned long. Hence switch the DIV6 clocks on SH/R-Mobile and R-Car SoCs from the old .round_rate() callback to the newer .determine_rate() callback, which does not suffer from this limitation. Signed-off-by: Geert Uytterhoeven <[email protected]> Link: https://lore.kernel.org/r/7fd8c45cd8bf5c6d928ca69c8b669be35b93de09.1617281699.git.geert+renesas@glider.be
1 parent 23b04c8 commit c9d1b58

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

drivers/clk/renesas/clk-div6.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -100,12 +100,14 @@ static unsigned int cpg_div6_clock_calc_div(unsigned long rate,
100100
return clamp(div, 1U, 64U);
101101
}
102102

103-
static long cpg_div6_clock_round_rate(struct clk_hw *hw, unsigned long rate,
104-
unsigned long *parent_rate)
103+
static int cpg_div6_clock_determine_rate(struct clk_hw *hw,
104+
struct clk_rate_request *req)
105105
{
106-
unsigned int div = cpg_div6_clock_calc_div(rate, *parent_rate);
106+
unsigned int div = cpg_div6_clock_calc_div(req->rate,
107+
req->best_parent_rate);
107108

108-
return *parent_rate / div;
109+
req->rate = req->best_parent_rate / div;
110+
return 0;
109111
}
110112

111113
static int cpg_div6_clock_set_rate(struct clk_hw *hw, unsigned long rate,
@@ -166,7 +168,7 @@ static const struct clk_ops cpg_div6_clock_ops = {
166168
.get_parent = cpg_div6_clock_get_parent,
167169
.set_parent = cpg_div6_clock_set_parent,
168170
.recalc_rate = cpg_div6_clock_recalc_rate,
169-
.round_rate = cpg_div6_clock_round_rate,
171+
.determine_rate = cpg_div6_clock_determine_rate,
170172
.set_rate = cpg_div6_clock_set_rate,
171173
};
172174

0 commit comments

Comments
 (0)