2 * Debugging macro include header
4 * Copyright (C) 1994-1999 Russell King
5 * Moved from linux/arch/arm/kernel/debug.S by Ben Dooks
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
13 #include <linux/serial_reg.h>
15 /* External port on Zoom2/3 */
16 #define ZOOM_UART_BASE 0x10000000
17 #define ZOOM_UART_VIRT 0xfa400000
19 #define OMAP_PORT_SHIFT 2
20 #define ZOOM_PORT_SHIFT 1
22 #define UART_OFFSET(addr) ((addr) & 0x00ffffff)
25 omap_uart_phys: .word 0
26 omap_uart_virt: .word 0
27 omap_uart_lsr: .word 0
30 .macro addruart, rp, rv, tmp
32 /* Use omap_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] @ omap_uart_phys
39 ldr \rv, [\tmp, #4] @ omap_uart_virt
40 cmp \rp, #0 @ is port configured?
42 bne 100f @ already configured
44 /* Configure the UART offset from the phys/virt base */
45 #ifdef CONFIG_DEBUG_ZOOM_UART
46 ldr \rp, =ZOOM_UART_BASE
47 str \rp, [\tmp, #0] @ omap_uart_phys
48 ldr \rp, =ZOOM_UART_VIRT
49 str \rp, [\tmp, #4] @ omap_uart_virt
50 mov \rp, #(UART_LSR << ZOOM_PORT_SHIFT)
51 str \rp, [\tmp, #8] @ omap_uart_lsr
60 100: /* Pass the UART_LSR reg address */
61 ldr \tmp, [\tmp, #8] @ omap_uart_lsr
67 orr \rd, \rd, \rx, lsl #24 @ preserve LSR reg offset
68 bic \rx, \rx, #0xff @ get base (THR) reg address
69 strb \rd, [\rx] @ send lower byte of rd
70 orr \rx, \rx, \rd, lsr #24 @ restore original rx (LSR)
71 bic \rd, \rd, #(0xff << 24) @ restore original rd
75 1001: ldrb \rd, [\rx] @ rx contains UART_LSR address
76 and \rd, \rd, #(UART_LSR_TEMT | UART_LSR_THRE)
77 teq \rd, #(UART_LSR_TEMT | UART_LSR_THRE)