public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 1/2] ARM: add wfi assembly macro
@ 2012-12-03  3:06 Rob Herring
  2012-12-03  3:06 ` [U-Boot] [PATCH 2/2] ARM: highbank: use wfi macro instead of inline asm Rob Herring
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Rob Herring @ 2012-12-03  3:06 UTC (permalink / raw)
  To: u-boot

From: Rob Herring <rob.herring@calxeda.com>

Since wfi instruction is only available on ARMv7, add a conditional
macro for it.

Signed-off-by: Rob Herring <rob.herring@calxeda.com>
---
 arch/arm/include/asm/system.h |    6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/arch/arm/include/asm/system.h b/arch/arm/include/asm/system.h
index 2b28a26..2f6aecd 100644
--- a/arch/arm/include/asm/system.h
+++ b/arch/arm/include/asm/system.h
@@ -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;
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [U-Boot] [PATCH 2/2] ARM: highbank: use wfi macro instead of inline asm
  2012-12-03  3:06 [U-Boot] [PATCH 1/2] ARM: add wfi assembly macro Rob Herring
@ 2012-12-03  3:06 ` Rob Herring
  2013-02-03 14:29   ` Albert ARIBAUD
  2012-12-03  4:58 ` [U-Boot] [PATCH 1/2] ARM: add wfi assembly macro Marek Vasut
  2013-02-03 14:29 ` Albert ARIBAUD
  2 siblings, 1 reply; 7+ messages in thread
From: Rob Herring @ 2012-12-03  3:06 UTC (permalink / raw)
  To: u-boot

From: Rob Herring <rob.herring@calxeda.com>

Older compilers don't recognize v7 wfi instruction, so use wfi macro to
fix builds on old compilers.

Signed-off-by: Rob Herring <rob.herring@calxeda.com>
---
 board/highbank/highbank.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/board/highbank/highbank.c b/board/highbank/highbank.c
index f41bf05..09cd45d 100644
--- a/board/highbank/highbank.c
+++ b/board/highbank/highbank.c
@@ -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();
 }
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [U-Boot] [PATCH 1/2] ARM: add wfi assembly macro
  2012-12-03  3:06 [U-Boot] [PATCH 1/2] ARM: add wfi assembly macro Rob Herring
  2012-12-03  3:06 ` [U-Boot] [PATCH 2/2] ARM: highbank: use wfi macro instead of inline asm Rob Herring
@ 2012-12-03  4:58 ` Marek Vasut
  2012-12-03 13:32   ` Rob Herring
  2013-02-03 14:29 ` Albert ARIBAUD
  2 siblings, 1 reply; 7+ messages in thread
From: Marek Vasut @ 2012-12-03  4:58 UTC (permalink / raw)
  To: u-boot

Dear Rob Herring,

> From: Rob Herring <rob.herring@calxeda.com>
> 
> Since wfi instruction is only available on ARMv7, add a conditional
> macro for it.
> 
> Signed-off-by: Rob Herring <rob.herring@calxeda.com>
> ---
>  arch/arm/include/asm/system.h |    6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/arch/arm/include/asm/system.h b/arch/arm/include/asm/system.h
> index 2b28a26..2f6aecd 100644
> --- a/arch/arm/include/asm/system.h
> +++ b/arch/arm/include/asm/system.h
> @@ -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?

>  static inline unsigned int get_cr(void)
>  {
>  	unsigned int val;

Best regards,
Marek Vasut

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [U-Boot] [PATCH 1/2] ARM: add wfi assembly macro
  2012-12-03  4:58 ` [U-Boot] [PATCH 1/2] ARM: add wfi assembly macro Marek Vasut
@ 2012-12-03 13:32   ` Rob Herring
  2012-12-03 14:39     ` Marek Vasut
  0 siblings, 1 reply; 7+ messages in thread
From: Rob Herring @ 2012-12-03 13:32 UTC (permalink / raw)
  To: u-boot



On 12/02/2012 10:58 PM, Marek Vasut wrote:
> Dear Rob Herring,
> 
>> From: Rob Herring <rob.herring@calxeda.com>
>>
>> Since wfi instruction is only available on ARMv7, add a conditional
>> macro for it.
>>
>> Signed-off-by: Rob Herring <rob.herring@calxeda.com>
>> ---
>>  arch/arm/include/asm/system.h |    6 ++++++
>>  1 file changed, 6 insertions(+)
>>
>> diff --git a/arch/arm/include/asm/system.h b/arch/arm/include/asm/system.h
>> index 2b28a26..2f6aecd 100644
>> --- a/arch/arm/include/asm/system.h
>> +++ b/arch/arm/include/asm/system.h
>> @@ -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?

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

> 
>>  static inline unsigned int get_cr(void)
>>  {
>>  	unsigned int val;
> 
> Best regards,
> Marek Vasut
> 

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [U-Boot] [PATCH 1/2] ARM: add wfi assembly macro
  2012-12-03 13:32   ` Rob Herring
@ 2012-12-03 14:39     ` Marek Vasut
  0 siblings, 0 replies; 7+ messages in thread
From: Marek Vasut @ 2012-12-03 14:39 UTC (permalink / raw)
  To: u-boot

Dear Rob Herring,

> On 12/02/2012 10:58 PM, Marek Vasut wrote:
> > Dear Rob Herring,
> > 
> >> From: Rob Herring <rob.herring@calxeda.com>
> >> 
> >> Since wfi instruction is only available on ARMv7, add a conditional
> >> macro for it.
> >> 
> >> Signed-off-by: Rob Herring <rob.herring@calxeda.com>
> >> ---
> >> 
> >>  arch/arm/include/asm/system.h |    6 ++++++
> >>  1 file changed, 6 insertions(+)
> >> 
> >> diff --git a/arch/arm/include/asm/system.h
> >> b/arch/arm/include/asm/system.h index 2b28a26..2f6aecd 100644
> >> --- a/arch/arm/include/asm/system.h
> >> +++ b/arch/arm/include/asm/system.h
> >> @@ -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?
> 
> 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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [U-Boot] [PATCH 1/2] ARM: add wfi assembly macro
  2012-12-03  3:06 [U-Boot] [PATCH 1/2] ARM: add wfi assembly macro Rob Herring
  2012-12-03  3:06 ` [U-Boot] [PATCH 2/2] ARM: highbank: use wfi macro instead of inline asm Rob Herring
  2012-12-03  4:58 ` [U-Boot] [PATCH 1/2] ARM: add wfi assembly macro Marek Vasut
@ 2013-02-03 14:29 ` Albert ARIBAUD
  2 siblings, 0 replies; 7+ messages in thread
From: Albert ARIBAUD @ 2013-02-03 14:29 UTC (permalink / raw)
  To: u-boot

Hi Rob,

On Sun,  2 Dec 2012 21:06:21 -0600, Rob Herring <robherring2@gmail.com>
wrote:

> From: Rob Herring <rob.herring@calxeda.com>
> 
> Since wfi instruction is only available on ARMv7, add a conditional
> macro for it.
> 
> Signed-off-by: Rob Herring <rob.herring@calxeda.com>
> ---
>  arch/arm/include/asm/system.h |    6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/arch/arm/include/asm/system.h b/arch/arm/include/asm/system.h
> index 2b28a26..2f6aecd 100644
> --- a/arch/arm/include/asm/system.h
> +++ b/arch/arm/include/asm/system.h
> @@ -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;

Applied to u-boot-arm/master, thanks!

Amicalement,
-- 
Albert.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [U-Boot] [PATCH 2/2] ARM: highbank: use wfi macro instead of inline asm
  2012-12-03  3:06 ` [U-Boot] [PATCH 2/2] ARM: highbank: use wfi macro instead of inline asm Rob Herring
@ 2013-02-03 14:29   ` Albert ARIBAUD
  0 siblings, 0 replies; 7+ messages in thread
From: Albert ARIBAUD @ 2013-02-03 14:29 UTC (permalink / raw)
  To: u-boot

Hi Rob,

On Sun,  2 Dec 2012 21:06:22 -0600, Rob Herring <robherring2@gmail.com>
wrote:

> From: Rob Herring <rob.herring@calxeda.com>
> 
> Older compilers don't recognize v7 wfi instruction, so use wfi macro to
> fix builds on old compilers.
> 
> Signed-off-by: Rob Herring <rob.herring@calxeda.com>
> ---
>  board/highbank/highbank.c |    3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/board/highbank/highbank.c b/board/highbank/highbank.c
> index f41bf05..09cd45d 100644
> --- a/board/highbank/highbank.c
> +++ b/board/highbank/highbank.c
> @@ -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,
-- 
Albert.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2013-02-03 14:29 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-12-03  3:06 [U-Boot] [PATCH 1/2] ARM: add wfi assembly macro Rob Herring
2012-12-03  3:06 ` [U-Boot] [PATCH 2/2] ARM: highbank: use wfi macro instead of inline asm Rob Herring
2013-02-03 14:29   ` Albert ARIBAUD
2012-12-03  4:58 ` [U-Boot] [PATCH 1/2] ARM: add wfi assembly macro Marek Vasut
2012-12-03 13:32   ` Rob Herring
2012-12-03 14:39     ` Marek Vasut
2013-02-03 14:29 ` Albert ARIBAUD

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox