diff options
Diffstat (limited to 'drivers/clk/at91/clk-utmi.c')
-rw-r--r-- | drivers/clk/at91/clk-utmi.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/clk/at91/clk-utmi.c b/drivers/clk/at91/clk-utmi.c index 0b562610a2..e8506099fd 100644 --- a/drivers/clk/at91/clk-utmi.c +++ b/drivers/clk/at91/clk-utmi.c @@ -28,6 +28,7 @@ static int utmi_clk_enable(struct clk *clk) u32 utmi_ref_clk_freq; u32 tmp; int err; + int timeout = 2000000; if (readl(&pmc->sr) & AT91_PMC_LOCKU) return 0; @@ -85,8 +86,12 @@ static int utmi_clk_enable(struct clk *clk) AT91_PMC_BIASEN; 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; } |