blob: de3fc2182b47be849d7b7e98ec64cd0179471357 [file] [log] [blame]
Kevin Hilman7c6337e2007-04-30 19:37:19 +01001/*
2 * Debugging macro for DaVinci
3 *
4 * Author: Kevin Hilman, MontaVista Software, Inc. <source@mvista.com>
5 *
6 * 2007 (c) MontaVista Software, Inc. This file is licensed under
7 * the terms of the GNU General Public License version 2. This program
8 * is licensed "as is" without any warranty of any kind, whether express
9 * or implied.
10 */
11
Chaithrika U S17eb1572009-01-19 14:13:05 +053012/* Modifications
13 * Jan 2009 Chaithrika U S Added senduart, busyuart, waituart
14 * macros, based on debug-8250.S file
15 * but using 32-bit accesses required for
16 * some davinci devices.
17 */
18
19#include <linux/serial_reg.h>
20#define UART_SHIFT 2
21
Kevin Hilman7c6337e2007-04-30 19:37:19 +010022 .macro addruart, rx
23 mrc p15, 0, \rx, c1, c0
24 tst \rx, #1 @ MMU enabled?
25 moveq \rx, #0x01000000 @ physical base address
26 movne \rx, #0xfe000000 @ virtual base
27 orr \rx, \rx, #0x00c20000 @ UART 0
28 .endm
29
Chaithrika U S17eb1572009-01-19 14:13:05 +053030 .macro senduart,rd,rx
31 str \rd, [\rx, #UART_TX << UART_SHIFT]
32 .endm
33
34 .macro busyuart,rd,rx
351002: ldr \rd, [\rx, #UART_LSR << UART_SHIFT]
36 and \rd, \rd, #UART_LSR_TEMT | UART_LSR_THRE
37 teq \rd, #UART_LSR_TEMT | UART_LSR_THRE
38 bne 1002b
39 .endm
40
41 .macro waituart,rd,rx
42#ifdef FLOW_CONTROL
431001: ldr \rd, [\rx, #UART_MSR << UART_SHIFT]
44 tst \rd, #UART_MSR_CTS
45 beq 1001b
46#endif
47 .endm
48