blob: d2b431f5443ffd68864218dc7486fbe6d8f2a73d [file] [log] [blame]
Masahiro Yamada978bc652015-01-06 14:28:16 +09001/*
Masahiro Yamada54cc3292015-05-29 17:30:02 +09002 * Copyright (C) 2014-2015 Masahiro Yamada <yamada.masahiro@socionext.com>
Masahiro Yamada978bc652015-01-06 14:28:16 +09003 *
4 * SPDX-License-Identifier: GPL-2.0+
5 */
6
7#include <linux/serial_reg.h>
8
9#if !defined(CONFIG_DEBUG_SEMIHOSTING)
10#include CONFIG_DEBUG_LL_INCLUDE
11#endif
12
13#define BAUDRATE 115200
14#define DIV_ROUND(x, d) (((x) + ((d) / 2)) / (d))
15#define DIVISOR DIV_ROUND(UART_CLK, 16 * BAUDRATE)
16
17 .macro init_debug_uart, ra, rb, rc
18 addruart \ra, \rb, \rc
Masahiro Yamada54cc3292015-05-29 17:30:02 +090019 mov \rb, #UART_LCR_WLEN8 << 8
20 str \rb, [\ra, #0x10]
Masahiro Yamada978bc652015-01-06 14:28:16 +090021 ldr \rb, =DIVISOR
22 str \rb, [\ra, #0x24]
23 .endm