ARM: add wfi assembly macro
PATCH 1/2 ARM: add wfi assembly macro
From: Rob Herring <[email protected]>
Since wfi instruction is only available on ARMv7, add a conditional macro for it.
--- arch/arm/include/asm/system.h | 6 ++++++ 1 file changed, 6 insertions(+)
arch/arm/include/asm/system.h +6 -0
@@ -61,6 +61,12 @@#define nop () __asm__ __volatile__("mov\tr0,r0\t@ nop\n\t"); +#ifdef __ARM_ARCH_7A__ +#define wfi () __asm__ __volatile__ ("wfi" : : : "memory") +#else +#define wfi () +#endif +static inline unsigned int get_cr (void ) {unsigned int val;
Signature · 1 line
1.7.10.4
PATCH 2/2 ARM: highbank: use wfi macro instead of inline asm
From: Rob Herring <[email protected]>
Older compilers don't recognize v7 wfi instruction, so use wfi macro to fix builds on old compilers.
--- board/highbank/highbank.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
board/highbank/highbank.c +2 -1
@@ -88,5 +88,6 @@ void dram_init_banksize(void)void reset_cpu (ulong addr) {writel (HB_PWR_HARD_RESET ,HB_SREG_A9_PWR_REQ ); - asm(" wfi" ); + +wfi (); }
Signature · 1 line
1.7.10.4
PATCH 2/2 ARM: highbank: use wfi macro instead of inline asm
Hi Rob,
Quoted 15 lines · Rob Herring
From: Rob Herring <[email protected]>
Older compilers don't recognize v7 wfi instruction, so use wfi macro to fix builds on old compilers.
Signed-off-by Rob Herring <[email protected]>--- board/highbank/highbank.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)board/highbank/highbank.c +0
-0
board/highbank/highbank.c void dram_init_banksize(void) · line 93
Quoted 7 lines
board/highbank/highbank.c +2
-1@@ -88,5 +88,6 @@ void dram_init_banksize(void)void reset_cpu (ulong addr) {writel (HB_PWR_HARD_RESET ,HB_SREG_A9_PWR_REQ ); - asm(" wfi" ); + +wfi (); }
Applied to u-boot-arm/master, thanks!
Amicalement,
Signature · 1 line
Albert.
PATCH 1/2 ARM: add wfi assembly macro
In reply to Rob HerringDear Rob Herring,
Quoted 15 lines
From: Rob Herring <[email protected]>
Since wfi instruction is only available on ARMv7, add a conditional macro for it.
Signed-off-by Rob Herring <[email protected]>--- arch/arm/include/asm/system.h | 6 ++++++ 1 file changed, 6 insertions(+)arch/arm/include/asm/system.h +0
-0
arch/arm/include/asm/system.h line 68
Quoted 8 lines
arch/arm/include/asm/system.h +5
-0@@ -61,6 +61,12 @@#define nop () __asm__ __volatile__("mov\tr0,r0\t@ nop\n\t"); +#ifdef __ARM_ARCH_7A__ +#define wfi () __asm__ __volatile__ ("wfi" : : : "memory") +#else +#define wfi () +#endif
Won't this break other (non-arm) systems? Moreover, maybe you can make this an (inline) function instead?
arch/arm/include/asm/system.h line 72
Quoted 3 lines
arch/arm/include/asm/system.h +0
-0static inline unsigned int get_cr (void ) {unsigned int val;
Best regards,
Marek Vasut
PATCH 1/2 ARM: add wfi assembly macro
Quoted 20 lines · Marek Vasut
Dear Rob Herring,
Quoted 18 lines
From: Rob Herring <[email protected]>
Since wfi instruction is only available on ARMv7, add a conditional macro for it.
Signed-off-by Rob Herring <[email protected]>--- arch/arm/include/asm/system.h | 6 ++++++ 1 file changed, 6 insertions(+)arch/arm/include/asm/system.h +0
-0@@ -61,6 +61,12 @@#define nop () __asm__ __volatile__("mov\tr0,r0\t@ nop\n\t");
Quoted 8 lines
arch/arm/include/asm/system.h line 68
Quoted 5 lines
arch/arm/include/asm/system.h +5
-0+#ifdef __ARM_ARCH_7A__ +#define wfi () __asm__ __volatile__ ("wfi" : : : "memory") +#else +#define wfi () +#endif Won't this break other (non-arm) systems? Moreover, maybe you can make this an (inline) function instead?
How? It is in an ARM specific header and empty on anything but ARMv7 enabled compiler. This follows the kernel implementation and the nop above.
Rob
Quoted 8 lines
arch/arm/include/asm/system.h line 72
Quoted 4 lines
arch/arm/include/asm/system.h +0
-0static inline unsigned int get_cr (void ) {unsigned int val;Best regards,
Marek Vasut
PATCH 1/2 ARM: add wfi assembly macro
Dear Rob Herring,
Quoted 31 lines · Marek Vasut
Quoted 21 lines
Dear Rob Herring,
Quoted 19 lines
From: Rob Herring <[email protected]>
Since wfi instruction is only available on ARMv7, add a conditional macro for it.
Signed-off-by Rob Herring <[email protected]>---
arch/arm/include/asm/system.h | 6 ++++++ 1 file changed, 6 insertions(+)(quoted diff) +0
-0
b/arch/arm/include/asm/system.hindex 2b28a26..2f6aecd 100644arch/arm/include/asm/system.h +0
-0@@ -61,6 +61,12 @@#define nop () __asm__ __volatile__("mov\tr0,r0\t@ nop\n\t");Quoted 8 lines
arch/arm/include/asm/system.h line 68
Quoted 5 lines
arch/arm/include/asm/system.h +5
-0+#ifdef __ARM_ARCH_7A__ +#define wfi () __asm__ __volatile__ ("wfi" : : : "memory") +#else +#define wfi () +#endif Won't this break other (non-arm) systems? Moreover, maybe you can make this an (inline) function instead?
Quoted 2 lines
How? It is in an ARM specific header and empty on anything but ARMv7 enabled compiler. This follows the kernel implementation and the nop above.
Ok, I missed the arch/arm. It's ok then, sorry for the noise. [...]
Best regards,
Marek Vasut
PATCH 1/2 ARM: add wfi assembly macro
In reply to Rob HerringHi Rob,
Quoted 17 lines · Rob Herring
From: Rob Herring <[email protected]>
Since wfi instruction is only available on ARMv7, add a conditional macro for it.
Signed-off-by Rob Herring <[email protected]>--- arch/arm/include/asm/system.h | 6 ++++++ 1 file changed, 6 insertions(+)arch/arm/include/asm/system.h +0
-0@@ -61,6 +61,12 @@#define nop () __asm__ __volatile__("mov\tr0,r0\t@ nop\n\t");
arch/arm/include/asm/system.h line 72
Quoted 10 lines
arch/arm/include/asm/system.h +6
-0+#ifdef __ARM_ARCH_7A__ +#define wfi () __asm__ __volatile__ ("wfi" : : : "memory") +#else +#define wfi () +#endif +static inline unsigned int get_cr (void ) {unsigned int val;
Applied to u-boot-arm/master, thanks!
Amicalement,
Signature · 1 line
Albert.