From f7edd7a31c3dc80158d4334717c1380d36e0b55a Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Thu, 13 Jun 2013 16:18:25 -0600 Subject: [PATCH] SAM3/4: Loop counter for PLL delay must be volatile or it may get optimized away --- arch/arm/src/sam34/sam3u_clockconfig.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/arm/src/sam34/sam3u_clockconfig.c b/arch/arm/src/sam34/sam3u_clockconfig.c index 71d918b8c2..500ed28391 100644 --- a/arch/arm/src/sam34/sam3u_clockconfig.c +++ b/arch/arm/src/sam34/sam3u_clockconfig.c @@ -151,7 +151,8 @@ static inline void sam_supcsetup(void) static void sam_pmcwait(uint32_t bit) { - uint32_t delay; + volatile uint32_t delay; + for (delay = 0; (getreg32(SAM_PMC_SR) & bit) == 0 && delay < UINT32_MAX; delay++);