linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] ARM: cci driver need big endian fixes in asm code
@ 2013-10-16  4:50 Victor Kamensky
  2013-10-16  4:50 ` Victor Kamensky
  0 siblings, 1 reply; 4+ messages in thread
From: Victor Kamensky @ 2013-10-16  4:50 UTC (permalink / raw)
  To: linux-arm-kernel

Hi All,

This is version 2 of cci big endian fix. Idea of this
way of fixing was suggested by Ben Dooks [1]. Compared to
previous solution this one does not use ifdefs and looks
much cleaner.

This was tested on TC2 both LE and BE, CONFIG_ARM_CCI
was enabled.

[1] http://lists.infradead.org/pipermail/linux-arm-kernel/2013-October/203248.html

Thanks,
Victor

Victor Kamensky (1):
  ARM: cci driver need big endian fixes in asm code

 drivers/bus/arm-cci.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

-- 
1.8.1.4

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

* [PATCH v2] ARM: cci driver need big endian fixes in asm code
  2013-10-16  4:50 [PATCH v2] ARM: cci driver need big endian fixes in asm code Victor Kamensky
@ 2013-10-16  4:50 ` Victor Kamensky
  2013-10-16 14:15   ` Nicolas Pitre
  2013-10-16 14:35   ` Ben Dooks
  0 siblings, 2 replies; 4+ messages in thread
From: Victor Kamensky @ 2013-10-16  4:50 UTC (permalink / raw)
  To: linux-arm-kernel

cci_enable_port_for_self written in asm and it works with h/w
registers that are in little endian format. When run in big
endian mode it needs byteswaped constants before/after it
writes/reads to/from such registers

Signed-off-by: Victor Kamensky <victor.kamensky@linaro.org>
Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
---
 drivers/bus/arm-cci.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/bus/arm-cci.c b/drivers/bus/arm-cci.c
index 57b0bc6..4328c25 100644
--- a/drivers/bus/arm-cci.c
+++ b/drivers/bus/arm-cci.c
@@ -872,7 +872,7 @@ asmlinkage void __naked cci_enable_port_for_self(void)
 
 	/* Enable the CCI port */
 "	ldr	r0, [r0, %[offsetof_port_phys]] \n"
-"	mov	r3, #"__stringify(CCI_ENABLE_REQ)" \n"
+"	mov	r3, %[cci_enable_req]\n"		   
 "	str	r3, [r0, #"__stringify(CCI_PORT_CTRL)"] \n"
 
 	/* poll the status reg for completion */
@@ -880,7 +880,7 @@ asmlinkage void __naked cci_enable_port_for_self(void)
 "	ldr	r0, [r1] \n"
 "	ldr	r0, [r0, r1]		@ cci_ctrl_base \n"
 "4:	ldr	r1, [r0, #"__stringify(CCI_CTRL_STATUS)"] \n"
-"	tst	r1, #1 \n"
+"	tst	r1, %[cci_control_status_bits] \n"			
 "	bne	4b \n"
 
 "	mov	r0, #0 \n"
@@ -893,6 +893,8 @@ asmlinkage void __naked cci_enable_port_for_self(void)
 "7:	.word	cci_ctrl_phys - . \n"
 	: :
 	[sizeof_cpu_port] "i" (sizeof(cpu_port)),
+	[cci_enable_req] "i" cpu_to_le32(CCI_ENABLE_REQ),
+	[cci_control_status_bits] "i" cpu_to_le32(1),
 #ifndef __ARMEB__
 	[offsetof_cpu_port_mpidr_lsb] "i" (offsetof(struct cpu_port, mpidr)),
 #else
-- 
1.8.1.4

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

* [PATCH v2] ARM: cci driver need big endian fixes in asm code
  2013-10-16  4:50 ` Victor Kamensky
@ 2013-10-16 14:15   ` Nicolas Pitre
  2013-10-16 14:35   ` Ben Dooks
  1 sibling, 0 replies; 4+ messages in thread
From: Nicolas Pitre @ 2013-10-16 14:15 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, 15 Oct 2013, Victor Kamensky wrote:

> cci_enable_port_for_self written in asm and it works with h/w
> registers that are in little endian format. When run in big
> endian mode it needs byteswaped constants before/after it
> writes/reads to/from such registers
> 
> Signed-off-by: Victor Kamensky <victor.kamensky@linaro.org>
> Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>

Acked-by: Nicolas Pitre <nico@linaro.org>

> ---
>  drivers/bus/arm-cci.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/bus/arm-cci.c b/drivers/bus/arm-cci.c
> index 57b0bc6..4328c25 100644
> --- a/drivers/bus/arm-cci.c
> +++ b/drivers/bus/arm-cci.c
> @@ -872,7 +872,7 @@ asmlinkage void __naked cci_enable_port_for_self(void)
>  
>  	/* Enable the CCI port */
>  "	ldr	r0, [r0, %[offsetof_port_phys]] \n"
> -"	mov	r3, #"__stringify(CCI_ENABLE_REQ)" \n"
> +"	mov	r3, %[cci_enable_req]\n"		   
>  "	str	r3, [r0, #"__stringify(CCI_PORT_CTRL)"] \n"
>  
>  	/* poll the status reg for completion */
> @@ -880,7 +880,7 @@ asmlinkage void __naked cci_enable_port_for_self(void)
>  "	ldr	r0, [r1] \n"
>  "	ldr	r0, [r0, r1]		@ cci_ctrl_base \n"
>  "4:	ldr	r1, [r0, #"__stringify(CCI_CTRL_STATUS)"] \n"
> -"	tst	r1, #1 \n"
> +"	tst	r1, %[cci_control_status_bits] \n"			
>  "	bne	4b \n"
>  
>  "	mov	r0, #0 \n"
> @@ -893,6 +893,8 @@ asmlinkage void __naked cci_enable_port_for_self(void)
>  "7:	.word	cci_ctrl_phys - . \n"
>  	: :
>  	[sizeof_cpu_port] "i" (sizeof(cpu_port)),
> +	[cci_enable_req] "i" cpu_to_le32(CCI_ENABLE_REQ),
> +	[cci_control_status_bits] "i" cpu_to_le32(1),
>  #ifndef __ARMEB__
>  	[offsetof_cpu_port_mpidr_lsb] "i" (offsetof(struct cpu_port, mpidr)),
>  #else
> -- 
> 1.8.1.4
> 

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

* [PATCH v2] ARM: cci driver need big endian fixes in asm code
  2013-10-16  4:50 ` Victor Kamensky
  2013-10-16 14:15   ` Nicolas Pitre
@ 2013-10-16 14:35   ` Ben Dooks
  1 sibling, 0 replies; 4+ messages in thread
From: Ben Dooks @ 2013-10-16 14:35 UTC (permalink / raw)
  To: linux-arm-kernel

On 16/10/13 05:50, Victor Kamensky wrote:
> cci_enable_port_for_self written in asm and it works with h/w
> registers that are in little endian format. When run in big
> endian mode it needs byteswaped constants before/after it
> writes/reads to/from such registers
>
> Signed-off-by: Victor Kamensky<victor.kamensky@linaro.org>
> Signed-off-by: Ben Dooks<ben.dooks@codethink.co.uk>
> ---
>   drivers/bus/arm-cci.c | 6 ++++--
>   1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/bus/arm-cci.c b/drivers/bus/arm-cci.c
> index 57b0bc6..4328c25 100644
> --- a/drivers/bus/arm-cci.c
> +++ b/drivers/bus/arm-cci.c
> @@ -872,7 +872,7 @@ asmlinkage void __naked cci_enable_port_for_self(void)
>
>   	/* Enable the CCI port */
>   "	ldr	r0, [r0, %[offsetof_port_phys]] \n"
> -"	mov	r3, #"__stringify(CCI_ENABLE_REQ)" \n"
> +"	mov	r3, %[cci_enable_req]\n"		
>   "	str	r3, [r0, #"__stringify(CCI_PORT_CTRL)"] \n"
>
>   	/* poll the status reg for completion */
> @@ -880,7 +880,7 @@ asmlinkage void __naked cci_enable_port_for_self(void)
>   "	ldr	r0, [r1] \n"
>   "	ldr	r0, [r0, r1]		@ cci_ctrl_base \n"
>   "4:	ldr	r1, [r0, #"__stringify(CCI_CTRL_STATUS)"] \n"
> -"	tst	r1, #1 \n"
> +"	tst	r1, %[cci_control_status_bits] \n"			
>   "	bne	4b \n"
>
>   "	mov	r0, #0 \n"
> @@ -893,6 +893,8 @@ asmlinkage void __naked cci_enable_port_for_self(void)
>   "7:	.word	cci_ctrl_phys - . \n"
>   	: :
>   	[sizeof_cpu_port] "i" (sizeof(cpu_port)),
> +	[cci_enable_req] "i" cpu_to_le32(CCI_ENABLE_REQ),
> +	[cci_control_status_bits] "i" cpu_to_le32(1),
>   #ifndef __ARMEB__
>   	[offsetof_cpu_port_mpidr_lsb] "i" (offsetof(struct cpu_port, mpidr)),
>   #else

Thanks

-- 
Ben Dooks				http://www.codethink.co.uk/
Senior Engineer				Codethink - Providing Genius

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

end of thread, other threads:[~2013-10-16 14:35 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-16  4:50 [PATCH v2] ARM: cci driver need big endian fixes in asm code Victor Kamensky
2013-10-16  4:50 ` Victor Kamensky
2013-10-16 14:15   ` Nicolas Pitre
2013-10-16 14:35   ` Ben Dooks

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).