diff mbox

[13/17] ARM: pl01x debug code endian fix

Message ID 1360365467-25056-14-git-send-email-ben.dooks@codethink.co.uk (mailing list archive)
State New, archived
Headers show

Commit Message

Ben Dooks Feb. 8, 2013, 11:17 p.m. UTC
The PL01X debug code needs to take into account which endian mode the
processor is running in. If it is big-endian, ensure the data is swapped
appropriately.

Note, we could do this slightly more efficiently if we have an macro to
do the necessary swap for the bits used by test.

Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
---
 arch/arm/include/asm/hardware/debug-pl01x.S |    8 ++++++++
 1 file changed, 8 insertions(+)

Comments

Russell King - ARM Linux Feb. 9, 2013, 12:09 p.m. UTC | #1
On Fri, Feb 08, 2013 at 11:17:43PM +0000, Ben Dooks wrote:
> +#ifdef __ARMEB__
> +#define ARM_BE(x...) x
> +#else
> +#define ARM_BE(x..)

Buggy.

> +#endif

Rather than littering the code with stuff like this, define it in one
central place please, and include it where necessary.
Ben Dooks Feb. 11, 2013, 7:19 p.m. UTC | #2
On 09/02/13 12:09, Russell King - ARM Linux wrote:
> On Fri, Feb 08, 2013 at 11:17:43PM +0000, Ben Dooks wrote:
>> +#ifdef __ARMEB__
>> +#define ARM_BE(x...) x
>> +#else
>> +#define ARM_BE(x..)
>
> Buggy.
>
>> +#endif
>
> Rather than littering the code with stuff like this, define it in one
> central place please, and include it where necessary.

I'll add this to arch/arm/include/asm/assembler.h
diff mbox

Patch

diff --git a/arch/arm/include/asm/hardware/debug-pl01x.S b/arch/arm/include/asm/hardware/debug-pl01x.S
index f9fd083..6f3a003 100644
--- a/arch/arm/include/asm/hardware/debug-pl01x.S
+++ b/arch/arm/include/asm/hardware/debug-pl01x.S
@@ -12,18 +12,26 @@ 
 */
 #include <linux/amba/serial.h>
 
+#ifdef __ARMEB__
+#define ARM_BE(x...) x
+#else
+#define ARM_BE(x..)
+#endif
+
 		.macro	senduart,rd,rx
 		strb	\rd, [\rx, #UART01x_DR]
 		.endm
 
 		.macro	waituart,rd,rx
 1001:		ldr	\rd, [\rx, #UART01x_FR]
+  ARM_BE(	rev	\rd, \rd )
 		tst	\rd, #UART01x_FR_TXFF
 		bne	1001b
 		.endm
 
 		.macro	busyuart,rd,rx
 1001:		ldr	\rd, [\rx, #UART01x_FR]
+  ARM_BE(	rev	\rd, \rd )
 		tst	\rd, #UART01x_FR_BUSY
 		bne	1001b
 		.endm