2 * Debugging macro for DaVinci
4 * Author: Kevin Hilman, MontaVista Software, Inc. <source@mvista.com>
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
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.
19 #include <linux/serial_reg.h>
21 #include <asm/memory.h>
23 #include <mach/serial.h>
27 #define davinci_uart_v2p(x) ((x) - PAGE_OFFSET + PLAT_PHYS_OFFSET)
28 #define davinci_uart_p2v(x) ((x) - PLAT_PHYS_OFFSET + PAGE_OFFSET)
31 davinci_uart_phys: .word 0
32 davinci_uart_virt: .word 0
35 .macro addruart, rp, rv
37 /* Use davinci_uart_phys/virt if already configured */
38 10: mrc p15, 0, \rp, c1, c0
39 tst \rp, #1 @ MMU enabled?
40 ldreq \rp, =davinci_uart_v2p(davinci_uart_phys)
41 ldrne \rp, =davinci_uart_phys
42 add \rv, \rp, #4 @ davinci_uart_virt
45 cmp \rp, #0 @ is port configured?
47 bne 99f @ already configured
49 /* Check the debug UART address set in uncompress.h */
50 mrc p15, 0, \rp, c1, c0
51 tst \rp, #1 @ MMU enabled?
53 /* Copy uart phys address from decompressor uart info */
54 ldreq \rv, =davinci_uart_v2p(davinci_uart_phys)
55 ldrne \rv, =davinci_uart_phys
56 ldreq \rp, =DAVINCI_UART_INFO
57 ldrne \rp, =davinci_uart_p2v(DAVINCI_UART_INFO)
61 /* Copy uart virt address from decompressor uart info */
62 ldreq \rv, =davinci_uart_v2p(davinci_uart_virt)
63 ldrne \rv, =davinci_uart_virt
64 ldreq \rp, =DAVINCI_UART_INFO
65 ldrne \rp, =davinci_uart_p2v(DAVINCI_UART_INFO)
74 str \rd, [\rx, #UART_TX << UART_SHIFT]
78 1002: ldr \rd, [\rx, #UART_LSR << UART_SHIFT]
79 and \rd, \rd, #UART_LSR_TEMT | UART_LSR_THRE
80 teq \rd, #UART_LSR_TEMT | UART_LSR_THRE
86 1001: ldr \rd, [\rx, #UART_MSR << UART_SHIFT]
87 tst \rd, #UART_MSR_CTS