mirror of
https://github.com/Fishwaldo/u-boot.git
synced 2025-06-27 00:51:50 +00:00
clk: at91: utmi: add timeout for utmi lock
In case the slow clock is not properly configured, the UTMI clock cannot lock the PLL, because UPLLCOUNT will "wait X slow clock cycles". In this case U-boot will loop indefinitely. Added a timeout in this case, to start U-boot even if UTMI clock is not enabled, so the user can use different media if needed, or investigate. Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
This commit is contained in:
parent
1246040cda
commit
e9cd3d7024
1 changed files with 6 additions and 1 deletions
|
@ -28,6 +28,7 @@ static int utmi_clk_enable(struct clk *clk)
|
||||||
u32 utmi_ref_clk_freq;
|
u32 utmi_ref_clk_freq;
|
||||||
u32 tmp;
|
u32 tmp;
|
||||||
int err;
|
int err;
|
||||||
|
int timeout = 2000000;
|
||||||
|
|
||||||
if (readl(&pmc->sr) & AT91_PMC_LOCKU)
|
if (readl(&pmc->sr) & AT91_PMC_LOCKU)
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -85,8 +86,12 @@ static int utmi_clk_enable(struct clk *clk)
|
||||||
AT91_PMC_BIASEN;
|
AT91_PMC_BIASEN;
|
||||||
writel(tmp, &pmc->uckr);
|
writel(tmp, &pmc->uckr);
|
||||||
|
|
||||||
while (!(readl(&pmc->sr) & AT91_PMC_LOCKU))
|
while ((--timeout) && !(readl(&pmc->sr) & AT91_PMC_LOCKU))
|
||||||
;
|
;
|
||||||
|
if (!timeout) {
|
||||||
|
printf("UTMICK: timeout waiting for UPLL lock\n");
|
||||||
|
return -ETIMEDOUT;
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue