ARM: at91: clock: fix the GCK's clock source

Before enabling a generated clock whose source is from the UPLL
clock, check and enable the UPLL clock.

Signed-off-by: Wenyou Yang <wenyou.yang@atmel.com>
Reviewed-by: Andreas Bießmann <andreas@biessmann.org>
This commit is contained in:
Wenyou Yang 2016-04-11 16:41:31 +08:00 committed by Andreas Bießmann
parent a9c89bf166
commit 4adf6a7157
1 changed files with 5 additions and 0 deletions

View File

@ -162,6 +162,11 @@ int at91_enable_periph_generated_clk(u32 id, u32 clk_source, u32 div)
if (div > 0xff)
return -EINVAL;
if (clk_source == GCK_CSS_UPLL_CLK) {
if (at91_upll_clk_enable())
return -ENODEV;
}
writel(id, &pmc->pcr);
regval = readl(&pmc->pcr);
regval &= ~AT91_PMC_PCR_GCKCSS;