mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-03 07:38:10 +00:00
Merge branch 'clk-at91' into clk-next
* clk-at91: clk: at91: programmable: remove unneeded register read clk: at91: optimize clk_round_rate() for AUDIO_PLL clk: at91: enable AUDIOPLL as source for PCKx on SAMA5D2
This commit is contained in:
commit
bd5e2ea291
3 changed files with 10 additions and 5 deletions
|
@ -340,7 +340,12 @@ static long clk_audio_pll_pmc_round_rate(struct clk_hw *hw, unsigned long rate,
|
||||||
pr_debug("A PLL/PMC: %s, rate = %lu (parent_rate = %lu)\n", __func__,
|
pr_debug("A PLL/PMC: %s, rate = %lu (parent_rate = %lu)\n", __func__,
|
||||||
rate, *parent_rate);
|
rate, *parent_rate);
|
||||||
|
|
||||||
for (div = 1; div <= AUDIO_PLL_QDPMC_MAX; div++) {
|
if (!rate)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
best_parent_rate = clk_round_rate(pclk->clk, 1);
|
||||||
|
div = max(best_parent_rate / rate, 1UL);
|
||||||
|
for (; div <= AUDIO_PLL_QDPMC_MAX; div++) {
|
||||||
best_parent_rate = clk_round_rate(pclk->clk, rate * div);
|
best_parent_rate = clk_round_rate(pclk->clk, rate * div);
|
||||||
tmp_rate = best_parent_rate / div;
|
tmp_rate = best_parent_rate / div;
|
||||||
tmp_diff = abs(rate - tmp_rate);
|
tmp_diff = abs(rate - tmp_rate);
|
||||||
|
@ -350,6 +355,8 @@ static long clk_audio_pll_pmc_round_rate(struct clk_hw *hw, unsigned long rate,
|
||||||
best_rate = tmp_rate;
|
best_rate = tmp_rate;
|
||||||
best_diff = tmp_diff;
|
best_diff = tmp_diff;
|
||||||
tmp_qd = div;
|
tmp_qd = div;
|
||||||
|
if (!best_diff)
|
||||||
|
break; /* got exact match */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -132,11 +132,8 @@ static int clk_programmable_set_rate(struct clk_hw *hw, unsigned long rate,
|
||||||
struct clk_programmable *prog = to_clk_programmable(hw);
|
struct clk_programmable *prog = to_clk_programmable(hw);
|
||||||
const struct clk_programmable_layout *layout = prog->layout;
|
const struct clk_programmable_layout *layout = prog->layout;
|
||||||
unsigned long div = parent_rate / rate;
|
unsigned long div = parent_rate / rate;
|
||||||
unsigned int pckr;
|
|
||||||
int shift = 0;
|
int shift = 0;
|
||||||
|
|
||||||
regmap_read(prog->regmap, AT91_PMC_PCKR(prog->id), &pckr);
|
|
||||||
|
|
||||||
if (!div)
|
if (!div)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
|
|
|
@ -241,13 +241,14 @@ static void __init sama5d2_pmc_setup(struct device_node *np)
|
||||||
parent_names[2] = "plladivck";
|
parent_names[2] = "plladivck";
|
||||||
parent_names[3] = "utmick";
|
parent_names[3] = "utmick";
|
||||||
parent_names[4] = "masterck";
|
parent_names[4] = "masterck";
|
||||||
|
parent_names[5] = "audiopll_pmcck";
|
||||||
for (i = 0; i < 3; i++) {
|
for (i = 0; i < 3; i++) {
|
||||||
char name[6];
|
char name[6];
|
||||||
|
|
||||||
snprintf(name, sizeof(name), "prog%d", i);
|
snprintf(name, sizeof(name), "prog%d", i);
|
||||||
|
|
||||||
hw = at91_clk_register_programmable(regmap, name,
|
hw = at91_clk_register_programmable(regmap, name,
|
||||||
parent_names, 5, i,
|
parent_names, 6, i,
|
||||||
&at91sam9x5_programmable_layout);
|
&at91sam9x5_programmable_layout);
|
||||||
if (IS_ERR(hw))
|
if (IS_ERR(hw))
|
||||||
goto err_free;
|
goto err_free;
|
||||||
|
|
Loading…
Reference in a new issue