@@ -313,4 +313,10 @@
.size \name , . - \name
.endm
+#define asm_constant_swab32(x) \
+ ((((x) & 0xff000000) >> 24) | \
+ (((x) & 0x00ff0000) >> 8) | \
+ (((x) & 0x0000ff00) << 8) | \
+ (((x) & 0x000000ff) << 24))
+
#endif /* __ASM_ASSEMBLER_H__ */
@@ -11,19 +11,27 @@
*
*/
#include <linux/amba/serial.h>
+#include <asm/assembler.h>
+#ifdef CONFIG_CPU_BIG_ENDIAN
+#define _UART01x_FR_TXFF asm_constant_swab32(UART01x_FR_TXFF)
+#define _UART01x_FR_BUSY asm_constant_swab32(UART01x_FR_BUSY)
+#else
+#define _UART01x_FR_TXFF UART01x_FR_TXFF
+#define _UART01x_FR_BUSY UART01x_FR_BUSY
+#endif
.macro senduart,rd,rx
strb \rd, [\rx, #UART01x_DR]
.endm
.macro waituart,rd,rx
1001: ldr \rd, [\rx, #UART01x_FR]
- tst \rd, #UART01x_FR_TXFF
+ tst \rd, #_UART01x_FR_TXFF
bne 1001b
.endm
.macro busyuart,rd,rx
1001: ldr \rd, [\rx, #UART01x_FR]
- tst \rd, #UART01x_FR_BUSY
+ tst \rd, #_UART01x_FR_BUSY
bne 1001b
.endm
The waituart and busyuart need to get one bit flag from UART flag register. For this, we don't need do endian conversion for the entire flag register, providing that flag definition in big-endian mode is enough. Signed-off-by: Junxiao Bi <junxiao.bi@windriver.com> --- arch/arm/include/asm/assembler.h | 6 ++++++ arch/arm/include/asm/hardware/debug-pl01x.S | 12 ++++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-)