Alexander Shiyan | dd99eef | 2014-06-19 19:26:34 +0400 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2014 Alexander Shiyan <shc_work@mail.ru> |
| 3 | * |
| 4 | * This program is free software; you can redistribute it and/or modify |
| 5 | * it under the terms of the GNU General Public License as published by |
| 6 | * the Free Software Foundation; either version 2 of the License, or |
| 7 | * (at your option) any later version. |
| 8 | */ |
| 9 | |
| 10 | #ifndef CONFIG_DEBUG_CLPS711X_UART2 |
| 11 | #define CLPS711X_UART_PADDR (0x80000000 + 0x0000) |
Alexander Shiyan | 32981ea | 2016-06-04 10:09:53 +0300 | [diff] [blame] | 12 | #define CLPS711X_UART_VADDR (0xfeff4000 + 0x0000) |
Alexander Shiyan | dd99eef | 2014-06-19 19:26:34 +0400 | [diff] [blame] | 13 | #else |
| 14 | #define CLPS711X_UART_PADDR (0x80000000 + 0x1000) |
Alexander Shiyan | 32981ea | 2016-06-04 10:09:53 +0300 | [diff] [blame] | 15 | #define CLPS711X_UART_VADDR (0xfeff4000 + 0x1000) |
Alexander Shiyan | dd99eef | 2014-06-19 19:26:34 +0400 | [diff] [blame] | 16 | #endif |
| 17 | |
| 18 | #define SYSFLG (0x0140) |
| 19 | #define SYSFLG_UBUSY (1 << 11) |
| 20 | #define UARTDR (0x0480) |
| 21 | |
| 22 | .macro addruart, rp, rv, tmp |
| 23 | ldr \rv, =CLPS711X_UART_VADDR |
| 24 | ldr \rp, =CLPS711X_UART_PADDR |
| 25 | .endm |
| 26 | |
| 27 | .macro waituart,rd,rx |
| 28 | .endm |
| 29 | |
| 30 | .macro senduart,rd,rx |
| 31 | str \rd, [\rx, #UARTDR] |
| 32 | .endm |
| 33 | |
| 34 | .macro busyuart,rd,rx |
| 35 | 1001: ldr \rd, [\rx, #SYSFLG] |
| 36 | tst \rd, #SYSFLG_UBUSY |
| 37 | bne 1001b |
| 38 | .endm |