16dde5ac5SShawn Guo/* arch/arm/mach-imx/include/mach/debug-macro.S 26dde5ac5SShawn Guo * 36dde5ac5SShawn Guo * Debugging macro include header 46dde5ac5SShawn Guo * 56dde5ac5SShawn Guo * Copyright (C) 1994-1999 Russell King 66dde5ac5SShawn Guo * Moved from linux/arch/arm/kernel/debug.S by Ben Dooks 76dde5ac5SShawn Guo * 86dde5ac5SShawn Guo * This program is free software; you can redistribute it and/or modify 96dde5ac5SShawn Guo * it under the terms of the GNU General Public License version 2 as 106dde5ac5SShawn Guo * published by the Free Software Foundation. 116dde5ac5SShawn Guo * 126dde5ac5SShawn Guo */ 1349c9e60eSShawn Guo 14f8c95fe6SShawn Guo#include "imx-uart.h" 156dde5ac5SShawn Guo 166dde5ac5SShawn Guo/* 176dde5ac5SShawn Guo * FIXME: This is a copy of IMX_IO_P2V in hardware.h, and needs to 186dde5ac5SShawn Guo * stay sync with that. It's hard to maintain, and should be fixed 196dde5ac5SShawn Guo * globally for multi-platform build to use a fixed virtual address 206dde5ac5SShawn Guo * for low-level debug uart port across platforms. 216dde5ac5SShawn Guo */ 226dde5ac5SShawn Guo#define IMX_IO_P2V(x) ( \ 236dde5ac5SShawn Guo (((x) & 0x80000000) >> 7) | \ 246dde5ac5SShawn Guo (0xf4000000 + \ 256dde5ac5SShawn Guo (((x) & 0x50000000) >> 6) + \ 266dde5ac5SShawn Guo (((x) & 0x0b000000) >> 4) + \ 276dde5ac5SShawn Guo (((x) & 0x000fffff)))) 286dde5ac5SShawn Guo 296dde5ac5SShawn Guo#define UART_VADDR IMX_IO_P2V(UART_PADDR) 306dde5ac5SShawn Guo 316dde5ac5SShawn Guo .macro addruart, rp, rv, tmp 326dde5ac5SShawn Guo ldr \rp, =UART_PADDR @ physical 336dde5ac5SShawn Guo ldr \rv, =UART_VADDR @ virtual 346dde5ac5SShawn Guo .endm 356dde5ac5SShawn Guo 366dde5ac5SShawn Guo .macro senduart,rd,rx 376dde5ac5SShawn Guo str \rd, [\rx, #0x40] @ TXDATA 386dde5ac5SShawn Guo .endm 396dde5ac5SShawn Guo 406dde5ac5SShawn Guo .macro waituart,rd,rx 416dde5ac5SShawn Guo .endm 426dde5ac5SShawn Guo 436dde5ac5SShawn Guo .macro busyuart,rd,rx 446dde5ac5SShawn Guo1002: ldr \rd, [\rx, #0x98] @ SR2 456dde5ac5SShawn Guo tst \rd, #1 << 3 @ TXDC 466dde5ac5SShawn Guo beq 1002b @ wait until transmit done 476dde5ac5SShawn Guo .endm 48