[U-Boot] [PATCH] arm: at91: clock: Add the generated clock support

Bo Shen voice.shen at gmail.com
Fri Sep 11 23:48:18 CEST 2015


Hi Wenyou,

On 09/11/2015 10:01 AM, Yang, Wenyou wrote:
>>> +
>>> > >+void at91_enable_periph_generated_clk(u32 id) {
>>> > >+	struct at91_pmc *pmc = (struct at91_pmc *)ATMEL_BASE_PMC;
>>> > >+	u32 regval;
>>> > >+
>>> > >+	if (id > AT91_PMC_PCR_PID_MASK)
>>> > >+		return;
>>> > >+
>>> > >+	writel(id, &pmc->pcr);
>>> > >+	regval = readl(&pmc->pcr);
>>> > >+	regval &= ~AT91_PMC_PCR_GCKCSS;
>>> > >+	regval &= ~AT91_PMC_PCR_GCKDIV;
>>> > >+	regval |= AT91_PMC_PCR_GCKCSS_PLLA_CLK |
>>> > >+		  AT91_PMC_PCR_CMD_WRITE |
>>> > >+		  AT91_PMC_PCR_GCKDIV_(1) |
>>> > >+		  AT91_PMC_PCR_GCKEN;
>>> > >+
>>> > >+	writel(regval, &pmc->pcr);
>>> > >+
>>> > >+	while (!(readl(&pmc->sr) & AT91_PMC_GCKRDY))
>>> > >+		;
>> >
>> >Here, do we need to hang the whole system?
> Do you mean, add the timeout to while()?

Yes, something like that.

> But we think if the clock can't reach to a stable state, the system must be in wrong condition.
> So, I don't think this timeout is necessary.

As no datasheet for this. According to the code, the clock is for the 
peripheral which want to use the generated clock. So, it only affect 
this peripheral while not whole system, am I right?

Best Regards,
Bo Shen


More information about the U-Boot mailing list