blob: af55feed04799b3bf013dc0095c096f496ef1cee [file] [log] [blame]
Masahiro Yamada978bc652015-01-06 14:28:16 +09001/*
2 * Copyright (C) 2014 Panasonic Corporation
3 * Author: Masahiro Yamada <yamada.m@jp.panasonic.com>
4 *
5 * SPDX-License-Identifier: GPL-2.0+
6 */
7
8#include <linux/serial_reg.h>
9
10#if !defined(CONFIG_DEBUG_SEMIHOSTING)
11#include CONFIG_DEBUG_LL_INCLUDE
12#endif
13
14#define BAUDRATE 115200
15#define DIV_ROUND(x, d) (((x) + ((d) / 2)) / (d))
16#define DIVISOR DIV_ROUND(UART_CLK, 16 * BAUDRATE)
17
18 .macro init_debug_uart, ra, rb, rc
19 addruart \ra, \rb, \rc
20 mov \rb, #UART_LCR_WLEN8
21 strb \rb, [\ra, #0x11]
22 ldr \rb, =DIVISOR
23 str \rb, [\ra, #0x24]
24 .endm