Skip to content

Commit ebd47c8

Browse files
committed
Merge branches 'clk-bulk-fix', 'clk-at91' and 'clk-sprd' into clk-next
- Make clk_bulk_get_all() return an 'id' corresponding to clock-names * clk-bulk-fix: clk: Make clk_bulk_get_all() return a valid "id" * clk-at91: clk: at91: allow 24 Mhz clock as input for PLL clk: at91: select parent if main oscillator or bypass is enabled clk: at91: fix update bit maps on CFG_MOR write * clk-sprd: clk: sprd: add missing kfree
4 parents b6c444d + 7f81c24 + 81a6b60 + 5e75ea9 commit ebd47c8

4 files changed

Lines changed: 15 additions & 6 deletions

File tree

‎drivers/clk/at91/clk-main.c‎

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@
2121

2222
#define MOR_KEY_MASK (0xff << 16)
2323

24+
#define clk_main_parent_select(s) (((s) & \
25+
(AT91_PMC_MOSCEN | \
26+
AT91_PMC_OSCBYPASS)) ? 1 : 0)
27+
2428
struct clk_main_osc {
2529
struct clk_hw hw;
2630
struct regmap *regmap;
@@ -113,7 +117,7 @@ static int clk_main_osc_is_prepared(struct clk_hw *hw)
113117

114118
regmap_read(regmap, AT91_PMC_SR, &status);
115119

116-
return (status & AT91_PMC_MOSCS) && (tmp & AT91_PMC_MOSCEN);
120+
return (status & AT91_PMC_MOSCS) && clk_main_parent_select(tmp);
117121
}
118122

119123
static const struct clk_ops main_osc_ops = {
@@ -152,7 +156,7 @@ at91_clk_register_main_osc(struct regmap *regmap,
152156
if (bypass)
153157
regmap_update_bits(regmap,
154158
AT91_CKGR_MOR, MOR_KEY_MASK |
155-
AT91_PMC_MOSCEN,
159+
AT91_PMC_OSCBYPASS,
156160
AT91_PMC_OSCBYPASS | AT91_PMC_KEY);
157161

158162
hw = &osc->hw;
@@ -450,7 +454,7 @@ static u8 clk_sam9x5_main_get_parent(struct clk_hw *hw)
450454

451455
regmap_read(clkmain->regmap, AT91_CKGR_MOR, &status);
452456

453-
return status & AT91_PMC_MOSCEN ? 1 : 0;
457+
return clk_main_parent_select(status);
454458
}
455459

456460
static const struct clk_ops sam9x5_main_ops = {
@@ -492,7 +496,7 @@ at91_clk_register_sam9x5_main(struct regmap *regmap,
492496
clkmain->hw.init = &init;
493497
clkmain->regmap = regmap;
494498
regmap_read(clkmain->regmap, AT91_CKGR_MOR, &status);
495-
clkmain->parent = status & AT91_PMC_MOSCEN ? 1 : 0;
499+
clkmain->parent = clk_main_parent_select(status);
496500

497501
hw = &clkmain->hw;
498502
ret = clk_hw_register(NULL, &clkmain->hw);

‎drivers/clk/at91/sama5d2.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ static const struct clk_range plla_outputs[] = {
2121
};
2222

2323
static const struct clk_pll_characteristics plla_characteristics = {
24-
.input = { .min = 12000000, .max = 12000000 },
24+
.input = { .min = 12000000, .max = 24000000 },
2525
.num_output = ARRAY_SIZE(plla_outputs),
2626
.output = plla_outputs,
2727
.icpll = plla_icpll,

‎drivers/clk/clk-bulk.c‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,13 @@ static int __must_check of_clk_bulk_get(struct device_node *np, int num_clks,
1818
int ret;
1919
int i;
2020

21-
for (i = 0; i < num_clks; i++)
21+
for (i = 0; i < num_clks; i++) {
22+
clks[i].id = NULL;
2223
clks[i].clk = NULL;
24+
}
2325

2426
for (i = 0; i < num_clks; i++) {
27+
of_property_read_string_index(np, "clock-names", i, &clks[i].id);
2528
clks[i].clk = of_clk_get(np, i);
2629
if (IS_ERR(clks[i].clk)) {
2730
ret = PTR_ERR(clks[i].clk);

‎drivers/clk/sprd/pll.c‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ static unsigned long _sprd_pll_recalc_rate(const struct sprd_pll *pll,
136136
k2 + refin * nint * CLK_PLL_1M;
137137
}
138138

139+
kfree(cfg);
139140
return rate;
140141
}
141142

@@ -222,6 +223,7 @@ static int _sprd_pll_set_rate(const struct sprd_pll *pll,
222223
if (!ret)
223224
udelay(pll->udelay);
224225

226+
kfree(cfg);
225227
return ret;
226228
}
227229

0 commit comments

Comments
 (0)