feat(plat/marvell/a3720/uart): preserve x1/x2 regs in console_a3700_core_init()

Followup changes will need function arguments in registers x0, x1 and
x2. Do not modify x1 and x2 registers and instead use scratch x3 and x4
registers for storing local variables.

Signed-off-by: Pali Rohár <pali@kernel.org>
Change-Id: I8551a802995f39128d2f4a8f8076b5bf463d0db0
This commit is contained in:
Pali Rohár 2021-11-15 10:51:28 +01:00 committed by Manish Pandey
parent 29ad12a7b5
commit 7c85a75729
1 changed files with 11 additions and 11 deletions

View File

@ -34,7 +34,7 @@
* w1 - Uart clock in Hz
* w2 - Baud rate
* Out: return 1 on success
* Clobber list : x1, x2, x3
* Clobber list : x1, x2, x3, x4
* -----------------------------------------------
*/
func console_a3700_core_init
@ -61,7 +61,7 @@ func console_a3700_core_init
* Wait for the TX (THR and TSR) to be empty. If wait for 3ms, the TX FIFO is
* still not empty, TX FIFO will reset by all means.
*/
mov w1, #30 /* max time out 30 * 100 us */
mov w4, #30 /* max time out 30 * 100 us */
2:
/* Check whether TX (THR and TSR) is empty */
ldr w3, [x0, #UART_STATUS_REG]
@ -70,15 +70,15 @@ func console_a3700_core_init
b.ne 4f
/* Delay */
mov w2, #60000 /* 60000 cycles of below 3 instructions on 1200 MHz CPU ~~ 100 us */
mov w3, #60000 /* 60000 cycles of below 3 instructions on 1200 MHz CPU ~~ 100 us */
3:
sub w2, w2, #1
cmp w2, #0
sub w3, w3, #1
cmp w3, #0
b.ne 3b
/* Check whether wait timeout expired */
sub w1, w1, #1
cmp w1, #0
sub w4, w4, #1
cmp w4, #0
b.ne 2b
4:
@ -88,10 +88,10 @@ func console_a3700_core_init
str w3, [x0, #UART_CTRL_REG]
/* Delay */
mov w2, #2000
mov w3, #2000
1:
sub w2, w2, #1
cmp w2, #0
sub w3, w3, #1
cmp w3, #0
b.ne 1b
/* No Parity, 1 Stop */
@ -118,7 +118,7 @@ endfunc console_a3700_core_init
* w2 - Baud rate
* x3 - pointer to empty console_t struct
* Out: return 1 on success, 0 on error
* Clobber list : x0, x1, x2, x6, x7, x14
* Clobber list : x0, x1, x2, x3, x4, x6, x7, x14
* -----------------------------------------------
*/
func console_a3700_register