1/* 2 * Copyright (c) 2018-2019, 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#include <drivers/renesas/rcar/console/console.h> 11 12 .globl console_rcar_register 13 .globl console_rcar_init 14 .globl console_rcar_putc 15 .globl console_rcar_flush 16 17 .extern rcar_log_init 18 .extern rcar_set_log_data 19 20 /* ----------------------------------------------- 21 * int console_rcar_register( 22 * uintptr_t base, uint32_t clk, uint32_t baud, 23 * console_t *console) 24 * Function to initialize and register a new rcar 25 * console. Storage passed in for the console struct 26 * *must* be persistent (i.e. not from the stack). 27 * In: x0 - UART register base address 28 * w1 - UART clock in Hz 29 * w2 - Baud rate 30 * x3 - pointer to empty console_t struct 31 * Out: return 1 on success, 0 on error 32 * Clobber list : x0, x1, x2, x6, x7, x14 33 * ----------------------------------------------- 34 */ 35func console_rcar_register 36 mov x7, x30 37 mov x6, x3 38 cbz x6, register_fail 39 str x0, [x6, #CONSOLE_T_BASE] 40 41 bl rcar_log_init 42 cbz x0, register_fail 43 44 mov x0, x6 45 mov x30, x7 46 finish_console_register rcar, putc=1, getc=0, flush=1 47 48register_fail: 49 ret x7 50endfunc console_rcar_register 51 52 /* --------------------------------------------- 53 * int console_rcar_init(unsigned long base_addr, 54 * unsigned int uart_clk, unsigned int baud_rate) 55 * Function to initialize the console without a 56 * C Runtime to print debug information. This 57 * function will be accessed by crash reporting. 58 * In: x0 - console base address 59 * w1 - Uart clock in Hz 60 * w2 - Baud rate 61 * Out: return 1 on success 62 * Clobber list : x1, x2 63 * --------------------------------------------- 64 */ 65func console_rcar_init 66 mov w0, #0 67 ret 68endfunc console_rcar_init 69 70 /* -------------------------------------------------------- 71 * int console_rcar_putc(int c, console_t *console) 72 * Function to output a character over the console. It 73 * returns the character printed on success or -1 on error. 74 * In : w0 - character to be printed 75 * x1 - pointer to console_t structure 76 * Out : return -1 on error else return character. 77 * Clobber list : x2 78 * -------------------------------------------------------- 79 */ 80func console_rcar_putc 81 b rcar_set_log_data 82endfunc console_rcar_putc 83 84 /* --------------------------------------------- 85 * void console_rcar_flush(void) 86 * Function to force a write of all buffered 87 * data that hasn't been output. It returns void 88 * Clobber list : x0, x1 89 * --------------------------------------------- 90 */ 91func console_rcar_flush 92 ret 93endfunc console_rcar_flush 94