Masahiro Yamada | 978bc65 | 2015-01-06 14:28:16 +0900 | [diff] [blame] | 1 | /* |
Masahiro Yamada | 54cc329 | 2015-05-29 17:30:02 +0900 | [diff] [blame] | 2 | * Copyright (C) 2014-2015 Masahiro Yamada <yamada.masahiro@socionext.com> |
Masahiro Yamada | 978bc65 | 2015-01-06 14:28:16 +0900 | [diff] [blame] | 3 | * |
| 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 Yamada | 54cc329 | 2015-05-29 17:30:02 +0900 | [diff] [blame] | 19 | mov \rb, #UART_LCR_WLEN8 << 8 |
| 20 | str \rb, [\ra, #0x10] |
Masahiro Yamada | 978bc65 | 2015-01-06 14:28:16 +0900 | [diff] [blame] | 21 | ldr \rb, =DIVISOR |
| 22 | str \rb, [\ra, #0x24] |
| 23 | .endm |