xref: /rk3399_ARM-atf/drivers/renesas/common/scif/scif_helpers.S (revision 6fb6bee1dfd7fd896c44cc21b02b4ef3aad3bbd0)
1/*
2 * Copyright (c) 2025, Renesas Electronics Corporation. All rights reserved.
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7#include <arch.h>
8#include <asm_macros.S>
9#include <console_macros.S>
10
11	.globl	console_rcar_register
12	.extern	console_rcar_init
13
14	/*
15	 * -----------------------------------------------
16	 * int console_rcar_register(
17	 *      uintptr_t base, uint32_t clk, uint32_t baud,
18	 *      console_t *console)
19	 * Function to initialize and register a new rcar
20	 * console. Storage passed in for the console struct
21	 * *must* be persistent (i.e. not from the stack).
22	 * In: x0 - UART register base address
23	 *     w1 - UART clock in Hz
24	 *     w2 - Baud rate
25	 *     x3 - pointer to empty console_t struct
26	 * Out: return 1 on success, 0 on error
27	 * Clobber list : x0, x1, x2, x6, x7, x14
28	 * -----------------------------------------------
29	 */
30func console_rcar_register
31	mov	x7, x30
32	mov	x6, x3
33	cbz	x6, register_fail
34	str	x0, [x6, #CONSOLE_T_BASE]
35
36	bl	console_rcar_init
37
38	mov	x0, x6
39	mov	x30, x7
40	finish_console_register rcar, putc=1, getc=0, flush=1
41
42register_fail:
43	ret	x7
44endfunc console_rcar_register
45