Skip to content

Commit 4be8c09

Browse files
author
Loic Poulain
committed
perf(imx): speed-up console/uart TX using FIFO
The current putc version test for TXEMPTY bit set (#6) instead of waiting for TXFULL bit clear (#4), that slows the global boot time as we are not taking benefit of the 32-byte FIFO. We then need to implement the flush function to be sure the transmit is complete (FIFO and shift register empty). Signed-off-by: Loic Poulain <loic.poulain@linaro.org> Change-Id: I54873a5203e2afdc230e44ce73284e7a80985b4f
1 parent ae006cd commit 4be8c09

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

plat/imx/common/imx_uart_console.S

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
#define URXD 0x0 /* Receiver Register */
1414
#define UTXD 0x40 /* Transmitter Register */
15+
#define USR2 0x98 /* UART Status Register 2 */
1516
#define UTS 0xb4 /* UART Test Register (mx31) */
1617
#define URXD_RX_DATA (0xFF)
1718

@@ -53,13 +54,13 @@ func console_imx_uart_putc
5354
1:
5455
/* Check if the transmit FIFO is full */
5556
ldr w2, [x1, #UTS]
56-
tbz w2, #6, 1b
57+
tbnz w2, #4, 1b
5758
mov w2, #0xD
5859
str w2, [x1, #UTXD]
5960
2:
6061
/* Check if the transmit FIFO is full */
6162
ldr w2, [x1, #UTS]
62-
tbz w2, #6, 2b
63+
tbnz w2, #4, 2b
6364
str w0, [x1, #UTXD]
6465
ret
6566
putc_error:
@@ -84,5 +85,13 @@ getc_error:
8485
endfunc console_imx_uart_getc
8586

8687
func console_imx_uart_flush
88+
ldr x0, [x0, #CONSOLE_T_BASE]
89+
cbz x0, flush_exit
90+
1:
91+
/* Wait for the transmit complete bit */
92+
ldr w1, [x0, #USR2]
93+
tbz w1, #3, 1b
94+
95+
flush_exit:
8796
ret
8897
endfunc console_imx_uart_flush

0 commit comments

Comments
 (0)