14
14
#include <linux/serial_reg.h>
16
#include <asm/memory.h>
18
16
#include <plat/serial.h>
20
#define omap_uart_v2p(x) ((x) - PAGE_OFFSET + PLAT_PHYS_OFFSET)
21
#define omap_uart_p2v(x) ((x) - PLAT_PHYS_OFFSET + PAGE_OFFSET)
24
19
omap_uart_phys: .word 0x0
25
20
omap_uart_virt: .word 0x0
31
26
* the desired UART phys and virt addresses temporarily into
32
27
* the omap_uart_phys and omap_uart_virt above.
34
.macro addruart, rp, rv
29
.macro addruart, rp, rv, tmp
36
31
/* Use omap_uart_phys/virt if already configured */
37
9: mrc p15, 0, \rp, c1, c0
38
tst \rp, #1 @ MMU enabled?
39
ldreq \rp, =omap_uart_v2p(omap_uart_phys) @ MMU disabled
40
ldrne \rp, =omap_uart_phys @ MMU enabled
41
add \rv, \rp, #4 @ omap_uart_virt
32
9: adr \rp, 99f @ get effective addr of 99f
33
ldr \rv, [\rp] @ get absolute addr of 99f
34
sub \rv, \rv, \rp @ offset between the two
35
ldr \rp, [\rp, #4] @ abs addr of omap_uart_phys
36
sub \tmp, \rp, \rv @ make it effective
37
ldr \rp, [\tmp, #0] @ omap_uart_phys
38
ldr \rv, [\tmp, #4] @ omap_uart_virt
44
39
cmp \rp, #0 @ is port configured?
46
bne 99f @ already configured
41
bne 100f @ already configured
48
43
/* Check the debug UART configuration set in uncompress.h */
49
mrc p15, 0, \rp, c1, c0
50
tst \rp, #1 @ MMU enabled?
51
ldreq \rp, =OMAP_UART_INFO @ MMU not enabled
52
ldrne \rp, =omap_uart_p2v(OMAP_UART_INFO) @ MMU enabled
44
and \rp, pc, #0xff000000
45
ldr \rv, =OMAP_UART_INFO_OFS
55
48
/* Select the UART to use based on the UART1 scratchpad value */
56
49
10: cmp \rp, #0 @ no port configured?
75
68
/* Store both phys and virt address for the uart */
76
69
98: add \rp, \rp, #0xff000000 @ phys base
77
mrc p15, 0, \rv, c1, c0
78
tst \rv, #1 @ MMU enabled?
79
ldreq \rv, =omap_uart_v2p(omap_uart_phys) @ MMU disabled
80
ldrne \rv, =omap_uart_phys @ MMU enabled
70
str \rp, [\tmp, #0] @ omap_uart_phys
82
71
sub \rp, \rp, #0xff000000 @ phys base
83
72
add \rp, \rp, #0xfe000000 @ virt base
84
add \rv, \rv, #4 @ omap_uart_lsr
73
str \rp, [\tmp, #4] @ omap_uart_virt
90
84
.macro senduart,rd,rx