• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /netgear-R7000-V1.0.7.12_1.2.5/components/opensource/linux/linux-2.6.36/arch/arm/mach-davinci/include/mach/
1/*
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
12/* 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
21#include <asm/memory.h>
22
23#include <mach/serial.h>
24
25#define UART_SHIFT	2
26
27		.pushsection .data
28davinci_uart_phys:	.word	0
29davinci_uart_virt:	.word	0
30		.popsection
31
32		.macro addruart, rx, tmp
33
34		/* Use davinci_uart_phys/virt if already configured */
3510:		mrc	p15, 0, \rx, c1, c0
36		tst	\rx, #1			@ MMU enabled?
37		ldreq	\rx, =__virt_to_phys(davinci_uart_phys)
38		ldrne	\rx, =davinci_uart_virt
39		ldr	\rx, [\rx]
40		cmp	\rx, #0			@ is port configured?
41		bne	99f			@ already configured
42
43		mrc	p15, 0, \rx, c1, c0
44		tst	\rx, #1			@ MMU enabled?
45
46		/* Copy uart phys address from decompressor uart info */
47		ldreq	\tmp, =__virt_to_phys(davinci_uart_phys)
48		ldrne	\tmp, =davinci_uart_phys
49		ldreq	\rx, =DAVINCI_UART_INFO
50		ldrne	\rx, =__phys_to_virt(DAVINCI_UART_INFO)
51		ldr	\rx, [\rx, #0]
52		str	\rx, [\tmp]
53
54		/* Copy uart virt address from decompressor uart info */
55		ldreq	\tmp, =__virt_to_phys(davinci_uart_virt)
56		ldrne	\tmp, =davinci_uart_virt
57		ldreq	\rx, =DAVINCI_UART_INFO
58		ldrne	\rx, =__phys_to_virt(DAVINCI_UART_INFO)
59		ldr	\rx, [\rx, #4]
60		str	\rx, [\tmp]
61
62		b	10b
6399:
64		.endm
65
66		.macro	senduart,rd,rx
67		str	\rd, [\rx, #UART_TX << UART_SHIFT]
68		.endm
69
70		.macro	busyuart,rd,rx
711002:		ldr	\rd, [\rx, #UART_LSR << UART_SHIFT]
72		and	\rd, \rd, #UART_LSR_TEMT | UART_LSR_THRE
73		teq	\rd, #UART_LSR_TEMT | UART_LSR_THRE
74		bne	1002b
75		.endm
76
77		.macro	waituart,rd,rx
78#ifdef FLOW_CONTROL
791001:		ldr	\rd, [\rx, #UART_MSR << UART_SHIFT]
80		tst	\rd, #UART_MSR_CTS
81		beq	1001b
82#endif
83		.endm
84