blob: 34290d14754b41b827208528c1a317e5d5fa62b3 [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>
Cyril Chemparathydc2eb762010-05-18 12:51:17 -040020
Cyril Chemparathydc2eb762010-05-18 12:51:17 -040021#include <mach/serial.h>
22
Chaithrika U S17eb1572009-01-19 14:13:05 +053023#define UART_SHIFT 2
24
Uwe Kleine-König477099f2012-03-22 10:29:23 +010025#if defined(CONFIG_DEBUG_DAVINCI_DMx_UART0)
26#define UART_BASE DAVINCI_UART0_BASE
27#elif defined(CONFIG_DEBUG_DAVINCI_DA8XX_UART0)
28#define UART_BASE DA8XX_UART0_BASE
29#elif defined(CONFIG_DEBUG_DAVINCI_DA8XX_UART1)
30#define UART_BASE DA8XX_UART1_BASE
31#elif defined(CONFIG_DEBUG_DAVINCI_DA8XX_UART2)
32#define UART_BASE DA8XX_UART2_BASE
33#elif defined(CONFIG_DEBUG_DAVINCI_TNETV107X_UART1)
34#define UART_BASE TNETV107X_UART2_BASE
35#define UART_VIRTBASE TNETV107X_UART2_VIRT
36#else
37#error "Select a specifc port for DEBUG_LL"
38#endif
39
40#ifndef UART_VIRTBASE
41#define UART_VIRTBASE IO_ADDRESS(UART_BASE)
42#endif
Cyril Chemparathydc2eb762010-05-18 12:51:17 -040043
Nicolas Pitre639da5e2011-08-31 22:55:46 -040044 .macro addruart, rp, rv, tmp
Uwe Kleine-König477099f2012-03-22 10:29:23 +010045 ldr \rp, =UART_BASE
46 ldr \rv, =UART_VIRTBASE
Kevin Hilman7c6337e2007-04-30 19:37:19 +010047 .endm
48
Chaithrika U S17eb1572009-01-19 14:13:05 +053049 .macro senduart,rd,rx
50 str \rd, [\rx, #UART_TX << UART_SHIFT]
51 .endm
52
53 .macro busyuart,rd,rx
541002: ldr \rd, [\rx, #UART_LSR << UART_SHIFT]
55 and \rd, \rd, #UART_LSR_TEMT | UART_LSR_THRE
56 teq \rd, #UART_LSR_TEMT | UART_LSR_THRE
57 bne 1002b
58 .endm
59
60 .macro waituart,rd,rx
61#ifdef FLOW_CONTROL
621001: ldr \rd, [\rx, #UART_MSR << UART_SHIFT]
63 tst \rd, #UART_MSR_CTS
64 beq 1001b
65#endif
66 .endm
67