spi-topcliff-pch: Fix issue for transmitting over 4KByte
[zen-stable.git] / arch / arm / mach-davinci / include / mach / debug-macro.S
blobcf94552d52740cd8c8d4903aa0549a05369b73cf
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  */
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  */
19 #include <linux/serial_reg.h>
21 #include <mach/serial.h>
23 #define UART_SHIFT      2
25                 .pushsection .data
26 davinci_uart_phys:      .word   0
27 davinci_uart_virt:      .word   0
28                 .popsection
30                 .macro addruart, rp, rv, tmp
32                 /* Use davinci_uart_phys/virt if already configured */
33 10:             adr     \rp, 99f                @ get effective addr of 99f
34                 ldr     \rv, [\rp]              @ get absolute addr of 99f
35                 sub     \rv, \rv, \rp           @ offset between the two
36                 ldr     \rp, [\rp, #4]          @ abs addr of omap_uart_phys
37                 sub     \tmp, \rp, \rv          @ make it effective
38                 ldr     \rp, [\tmp, #0]         @ davinci_uart_phys
39                 ldr     \rv, [\tmp, #4]         @ davinci_uart_virt
40                 cmp     \rp, #0                 @ is port configured?
41                 cmpne   \rv, #0
42                 bne     100f                    @ already configured
44                 /* Check the debug UART address set in uncompress.h */
45                 and     \rp, pc, #0xff000000
46                 ldr     \rv, =DAVINCI_UART_INFO_OFS
47                 add     \rp, \rp, \rv
49                 /* Copy uart phys address from decompressor uart info */
50                 ldr     \rv, [\rp, #0]
51                 str     \rv, [\tmp, #0]
53                 /* Copy uart virt address from decompressor uart info */
54                 ldr     \rv, [\rp, #4]
55                 str     \rv, [\tmp, #4]
57                 b       10b
59                 .align
60 99:             .word   .
61                 .word   davinci_uart_phys
62                 .ltorg
64 100:
65                 .endm
67                 .macro  senduart,rd,rx
68                 str     \rd, [\rx, #UART_TX << UART_SHIFT]
69                 .endm
71                 .macro  busyuart,rd,rx
72 1002:           ldr     \rd, [\rx, #UART_LSR << UART_SHIFT]
73                 and     \rd, \rd, #UART_LSR_TEMT | UART_LSR_THRE
74                 teq     \rd, #UART_LSR_TEMT | UART_LSR_THRE
75                 bne     1002b
76                 .endm
78                 .macro  waituart,rd,rx
79 #ifdef FLOW_CONTROL
80 1001:           ldr     \rd, [\rx, #UART_MSR << UART_SHIFT]
81                 tst     \rd, #UART_MSR_CTS
82                 beq     1001b
83 #endif
84                 .endm