Merge remote-tracking branches 'asoc/fix/atmel', 'asoc/fix/fsl', 'asoc/fix/tegra...
[linux-drm-fsl-dcu.git] / arch / arm / include / debug / efm32.S
1 /*
2  * Copyright (C) 2013 Pengutronix
3  * Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de>
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License version 2 as
7  * published by the Free Software Foundation.
8  */
9
10 #define UARTn_CMD               0x000c
11 #define UARTn_CMD_TXEN                  0x0004
12
13 #define UARTn_STATUS            0x0010
14 #define UARTn_STATUS_TXC                0x0020
15 #define UARTn_STATUS_TXBL               0x0040
16
17 #define UARTn_TXDATA            0x0034
18
19                 .macro  addruart, rx, tmp
20                 ldr     \rx, =(CONFIG_DEBUG_UART_PHYS)
21
22                 /*
23                  * enable TX. The driver might disable it to save energy. We
24                  * don't care about disabling at the end as during debug power
25                  * consumption isn't that important.
26                  */
27                 ldr     \tmp, =(UARTn_CMD_TXEN)
28                 str     \tmp, [\rx, #UARTn_CMD]
29                 .endm
30
31                 .macro  senduart,rd,rx
32                 strb    \rd, [\rx, #UARTn_TXDATA]
33                 .endm
34
35                 .macro  waituart,rd,rx
36 1001:           ldr     \rd, [\rx, #UARTn_STATUS]
37                 tst     \rd, #UARTn_STATUS_TXBL
38                 beq     1001b
39                 .endm
40
41                 .macro  busyuart,rd,rx
42 1001:           ldr     \rd, [\rx, UARTn_STATUS]
43                 tst     \rd, #UARTn_STATUS_TXC
44                 bne     1001b
45                 .endm