Path: blob/master/arch/arm/mach-davinci/include/mach/debug-macro.S
17480 views
/*1* Debugging macro for DaVinci2*3* Author: Kevin Hilman, MontaVista Software, Inc. <[email protected]>4*5* 2007 (c) MontaVista Software, Inc. This file is licensed under6* the terms of the GNU General Public License version 2. This program7* is licensed "as is" without any warranty of any kind, whether express8* or implied.9*/1011/* Modifications12* Jan 2009 Chaithrika U S Added senduart, busyuart, waituart13* macros, based on debug-8250.S file14* but using 32-bit accesses required for15* some davinci devices.16*/1718#include <linux/serial_reg.h>1920#include <asm/memory.h>2122#include <mach/serial.h>2324#define UART_SHIFT 22526#define davinci_uart_v2p(x) ((x) - PAGE_OFFSET + PLAT_PHYS_OFFSET)27#define davinci_uart_p2v(x) ((x) - PLAT_PHYS_OFFSET + PAGE_OFFSET)2829.pushsection .data30davinci_uart_phys: .word 031davinci_uart_virt: .word 032.popsection3334.macro addruart, rp, rv3536/* Use davinci_uart_phys/virt if already configured */3710: mrc p15, 0, \rp, c1, c038tst \rp, #1 @ MMU enabled?39ldreq \rp, =davinci_uart_v2p(davinci_uart_phys)40ldrne \rp, =davinci_uart_phys41add \rv, \rp, #4 @ davinci_uart_virt42ldr \rp, [\rp, #0]43ldr \rv, [\rv, #0]44cmp \rp, #0 @ is port configured?45cmpne \rv, #046bne 99f @ already configured4748/* Check the debug UART address set in uncompress.h */49mrc p15, 0, \rp, c1, c050tst \rp, #1 @ MMU enabled?5152/* Copy uart phys address from decompressor uart info */53ldreq \rv, =davinci_uart_v2p(davinci_uart_phys)54ldrne \rv, =davinci_uart_phys55ldreq \rp, =DAVINCI_UART_INFO56ldrne \rp, =davinci_uart_p2v(DAVINCI_UART_INFO)57ldr \rp, [\rp, #0]58str \rp, [\rv]5960/* Copy uart virt address from decompressor uart info */61ldreq \rv, =davinci_uart_v2p(davinci_uart_virt)62ldrne \rv, =davinci_uart_virt63ldreq \rp, =DAVINCI_UART_INFO64ldrne \rp, =davinci_uart_p2v(DAVINCI_UART_INFO)65ldr \rp, [\rp, #4]66str \rp, [\rv]6768b 10b6999:70.endm7172.macro senduart,rd,rx73str \rd, [\rx, #UART_TX << UART_SHIFT]74.endm7576.macro busyuart,rd,rx771002: ldr \rd, [\rx, #UART_LSR << UART_SHIFT]78and \rd, \rd, #UART_LSR_TEMT | UART_LSR_THRE79teq \rd, #UART_LSR_TEMT | UART_LSR_THRE80bne 1002b81.endm8283.macro waituart,rd,rx84#ifdef FLOW_CONTROL851001: ldr \rd, [\rx, #UART_MSR << UART_SHIFT]86tst \rd, #UART_MSR_CTS87beq 1001b88#endif89.endm90919293