@@ -97,8 +97,12 @@ static inline void __raw_writeb(u8 val, volatile void __iomem *addr)
#define __raw_writel __raw_writel
static inline void __raw_writel(u32 val, volatile void __iomem *addr)
{
+#if GCC_VERSION < 40200
+ *(volatile u32 __force *)addr = val;
+#else
asm volatile("str %1, %0"
: : "Qo" (*(volatile u32 __force *)addr), "r" (val));
+#endif
}
#define __raw_readb __raw_readb
@@ -115,9 +119,13 @@ static inline u8 __raw_readb(const volatile void __iomem *addr)
static inline u32 __raw_readl(const volatile void __iomem *addr)
{
u32 val;
+#if GCC_VERSION < 40200
+ val = *(volatile u32 __force *)addr;
+#else
asm volatile("ldr %0, %1"
: "=r" (val)
: "Qo" (*(volatile u32 __force *)addr));
+#endif
return val;
}
@@ -36,9 +36,12 @@ static inline unsigned long __my_cpu_offset(void)
* We want to allow caching the value, so avoid using volatile and
* instead use a fake stack read to hazard against barrier().
*/
+#if GCC_VERSION < 40200
+ asm("mrc p15, 0, %0, c13, c0, 4" : "=r" (off) : : "memory");
+#else
asm("mrc p15, 0, %0, c13, c0, 4" : "=r" (off)
: "Q" (*(const unsigned long *)current_stack_pointer));
-
+#endif
return off;
}
#define __my_cpu_offset __my_cpu_offset()
Building with ancient gcc versions results in a stream of build errors like: arch/arm/include/asm/io.h:100: error: impossible constraint in 'asm' arch/arm/include/asm/io.h:118: error: impossible constraint in 'asm' This reverts to an older version of __raw_readl, __raw_writel and __my_cpu_offset, which seem to be the only functions affected by this. Signed-off-by: Arnd Bergmann <arnd@arndb.de> --- arch/arm/include/asm/io.h | 8 ++++++++ arch/arm/include/asm/percpu.h | 5 ++++- 2 files changed, 12 insertions(+), 1 deletion(-) -- 2.9.0