[U-Boot] [PATCH] arm: mmu: Add missing volatile for reading SCTLR register

Alison Wang
2015-09-09T02:22:02Z

When building u-boot with the latest Linaro toolchain, such as
gcc-linaro-4.9, u-boot will hang at PCIE init on LS1021A platform.
The issue is reported on
http://comments.gmane.org/gmane.linux.linaro.toolchain/5163.

As volatile is missing when reading SCTLR register and SCTLR is set
according to the value read from SCTLR, it causes CR_M bit is not set.
Then MMU is not enabled, the access to VA for PCIE fails.

This patch will add the missing volatile for reading SCTLR register.

Signed-off-by: Alison Wang <alison.wang@freescale.com>
---
arch/arm/include/asm/system.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/include/asm/system.h b/arch/arm/include/asm/system.h
index 89f2294..f5096dc 100644
--- a/arch/arm/include/asm/system.h
+++ b/arch/arm/include/asm/system.h
@@ -155,7 +155,7 @@ void flush_l3_cache(void);
static inline unsigned int get_cr(void)
{
unsigned int val;
- asm("mrc p15, 0, %0, c1, c0, 0 @ get CR" : "=r" (val) : : "cc");
+ asm volatile("mrc p15, 0, %0, c1, c0, 0 @ get CR" : "=r" (val) : : "cc");
return val;
}

--
2.1.0.27.g96db324