Skip to content

Commit b3454ce

Browse files
committed
Merge tag 'clk-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/clk/linux
Pull clk fixes from Stephen Boyd: "Three clk driver fixes to close out the release - Fix a divider calculation breaking boot on Broadcom bcm2835 - Fix HDMI output on Tanix TX6 mini board by reverting a patch - Fix clk_set_rate_range() calls on at91 by considering the range while calculating the divisor" * tag 'clk-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/clk/linux: clk: at91: generated: consider range when calculating best rate Revert "clk: sunxi-ng: sun6i-rtc: Add support for H6" clk: bcm2835: fix bcm2835_clock_choose_div
2 parents 93413c8 + d0031e6 commit b3454ce

File tree

4 files changed

+22
-15
lines changed

4 files changed

+22
-15
lines changed

drivers/clk/at91/clk-generated.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,10 @@ static void clk_generated_best_diff(struct clk_rate_request *req,
117117
tmp_rate = parent_rate;
118118
else
119119
tmp_rate = parent_rate / div;
120+
121+
if (tmp_rate < req->min_rate || tmp_rate > req->max_rate)
122+
return;
123+
120124
tmp_diff = abs(req->rate - tmp_rate);
121125

122126
if (*best_diff < 0 || *best_diff >= tmp_diff) {

drivers/clk/bcm/clk-bcm2835.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -941,6 +941,7 @@ static u32 bcm2835_clock_choose_div(struct clk_hw *hw,
941941
u64 temp = (u64)parent_rate << CM_DIV_FRAC_BITS;
942942
u32 div, mindiv, maxdiv;
943943

944+
do_div(temp, rate);
944945
div = temp;
945946
div &= ~unused_frac_mask;
946947

drivers/clk/sunxi-ng/ccu-sun6i-rtc.c

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -298,10 +298,6 @@ static const struct sunxi_ccu_desc sun6i_rtc_ccu_desc = {
298298
.hw_clks = &sun6i_rtc_ccu_hw_clks,
299299
};
300300

301-
static const struct clk_parent_data sun50i_h6_osc32k_fanout_parents[] = {
302-
{ .hw = &osc32k_clk.common.hw },
303-
};
304-
305301
static const struct clk_parent_data sun50i_h616_osc32k_fanout_parents[] = {
306302
{ .hw = &osc32k_clk.common.hw },
307303
{ .fw_name = "pll-32k" },
@@ -314,13 +310,6 @@ static const struct clk_parent_data sun50i_r329_osc32k_fanout_parents[] = {
314310
{ .hw = &osc24M_32k_clk.common.hw }
315311
};
316312

317-
static const struct sun6i_rtc_match_data sun50i_h6_rtc_ccu_data = {
318-
.have_ext_osc32k = true,
319-
.have_iosc_calibration = true,
320-
.osc32k_fanout_parents = sun50i_h6_osc32k_fanout_parents,
321-
.osc32k_fanout_nparents = ARRAY_SIZE(sun50i_h6_osc32k_fanout_parents),
322-
};
323-
324313
static const struct sun6i_rtc_match_data sun50i_h616_rtc_ccu_data = {
325314
.have_iosc_calibration = true,
326315
.rtc_32k_single_parent = true,
@@ -335,10 +324,6 @@ static const struct sun6i_rtc_match_data sun50i_r329_rtc_ccu_data = {
335324
};
336325

337326
static const struct of_device_id sun6i_rtc_ccu_match[] = {
338-
{
339-
.compatible = "allwinner,sun50i-h6-rtc",
340-
.data = &sun50i_h6_rtc_ccu_data,
341-
},
342327
{
343328
.compatible = "allwinner,sun50i-h616-rtc",
344329
.data = &sun50i_h616_rtc_ccu_data,

drivers/rtc/rtc-sun6i.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -370,6 +370,23 @@ CLK_OF_DECLARE_DRIVER(sun8i_h3_rtc_clk, "allwinner,sun8i-h3-rtc",
370370
CLK_OF_DECLARE_DRIVER(sun50i_h5_rtc_clk, "allwinner,sun50i-h5-rtc",
371371
sun8i_h3_rtc_clk_init);
372372

373+
static const struct sun6i_rtc_clk_data sun50i_h6_rtc_data = {
374+
.rc_osc_rate = 16000000,
375+
.fixed_prescaler = 32,
376+
.has_prescaler = 1,
377+
.has_out_clk = 1,
378+
.export_iosc = 1,
379+
.has_losc_en = 1,
380+
.has_auto_swt = 1,
381+
};
382+
383+
static void __init sun50i_h6_rtc_clk_init(struct device_node *node)
384+
{
385+
sun6i_rtc_clk_init(node, &sun50i_h6_rtc_data);
386+
}
387+
CLK_OF_DECLARE_DRIVER(sun50i_h6_rtc_clk, "allwinner,sun50i-h6-rtc",
388+
sun50i_h6_rtc_clk_init);
389+
373390
/*
374391
* The R40 user manual is self-conflicting on whether the prescaler is
375392
* fixed or configurable. The clock diagram shows it as fixed, but there

0 commit comments

Comments
 (0)