ARM: keystone: Add minimal TI Keystone platform support
[cascardo/linux.git] / arch / arm / include / debug / keystone.S
1 /*
2  * Early serial debug output macro for Keystone SOCs
3  *
4  * Copyright 2013 Texas Instruments, Inc.
5  *      Santosh Shilimkar <santosh.shilimkar@ti.com>
6  *
7  * Based on RMKs low level debug code.
8  *  Copyright (C) 1994-1999 Russell King
9  *
10  * This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License version 2 as
12  * published by the Free Software Foundation.
13  */
14
15 #include <linux/serial_reg.h>
16
17 #define UART_SHIFT 2
18 #if defined(CONFIG_DEBUG_KEYSTONE_UART0)
19 #define UART_PHYS               0x02530c00
20 #define UART_VIRT               0xfeb30c00
21 #elif defined(CONFIG_DEBUG_KEYSTONE_UART1)
22 #define UART_PHYS               0x02531000
23 #define UART_VIRT               0xfeb31000
24 #endif
25
26         .macro  addruart, rp, rv, tmp
27         ldr     \rv, =UART_VIRT                 @ physical base address
28         ldr     \rp, =UART_PHYS                 @ virtual base address
29         .endm
30
31         .macro  senduart,rd,rx
32         str     \rd, [\rx, #UART_TX << UART_SHIFT]
33         .endm
34
35         .macro  busyuart,rd,rx
36 1002:   ldr     \rd, [\rx, #UART_LSR << UART_SHIFT]
37         and     \rd, \rd, #UART_LSR_TEMT | UART_LSR_THRE
38         teq     \rd, #UART_LSR_TEMT | UART_LSR_THRE
39         bne     1002b
40         .endm
41
42         .macro  waituart,rd,rx
43         .endm