Path: blob/master/arch/arm/mach-omap1/include/mach/debug-macro.S
10820 views
/* arch/arm/mach-omap1/include/mach/debug-macro.S1*2* Debugging macro include header3*4* Copyright (C) 1994-1999 Russell King5* Moved from linux/arch/arm/kernel/debug.S by Ben Dooks6*7* This program is free software; you can redistribute it and/or modify8* it under the terms of the GNU General Public License version 2 as9* published by the Free Software Foundation.10*11*/1213#include <linux/serial_reg.h>1415#include <asm/memory.h>1617#include <plat/serial.h>1819#define omap_uart_v2p(x) ((x) - PAGE_OFFSET + PLAT_PHYS_OFFSET)20#define omap_uart_p2v(x) ((x) - PLAT_PHYS_OFFSET + PAGE_OFFSET)2122.pushsection .data23omap_uart_phys: .word 0x024omap_uart_virt: .word 0x025.popsection2627/*28* Note that this code won't work if the bootloader passes29* a wrong machine ID number in r1. To debug, just hardcode30* the desired UART phys and virt addresses temporarily into31* the omap_uart_phys and omap_uart_virt above.32*/33.macro addruart, rp, rv3435/* Use omap_uart_phys/virt if already configured */369: mrc p15, 0, \rp, c1, c037tst \rp, #1 @ MMU enabled?38ldreq \rp, =omap_uart_v2p(omap_uart_phys) @ MMU disabled39ldrne \rp, =omap_uart_phys @ MMU enabled40add \rv, \rp, #4 @ omap_uart_virt41ldr \rp, [\rp, #0]42ldr \rv, [\rv, #0]43cmp \rp, #0 @ is port configured?44cmpne \rv, #045bne 99f @ already configured4647/* Check the debug UART configuration set in uncompress.h */48mrc p15, 0, \rp, c1, c049tst \rp, #1 @ MMU enabled?50ldreq \rp, =OMAP_UART_INFO @ MMU not enabled51ldrne \rp, =omap_uart_p2v(OMAP_UART_INFO) @ MMU enabled52ldr \rp, [\rp, #0]5354/* Select the UART to use based on the UART1 scratchpad value */5510: cmp \rp, #0 @ no port configured?56beq 11f @ if none, try to use UART157cmp \rp, #OMAP1UART158beq 11f @ configure OMAP1UART159cmp \rp, #OMAP1UART260beq 12f @ configure OMAP1UART261cmp \rp, #OMAP1UART362beq 13f @ configure OMAP2UART36364/* Configure the UART offset from the phys/virt base */6511: mov \rp, #0x00fb0000 @ OMAP1UART166b 98f6712: mov \rp, #0x00fb0000 @ OMAP1UART168orr \rp, \rp, #0x00000800 @ OMAP1UART269b 98f7013: mov \rp, #0x00fb0000 @ OMAP1UART171orr \rp, \rp, #0x00000800 @ OMAP1UART272orr \rp, \rp, #0x00009000 @ OMAP1UART37374/* Store both phys and virt address for the uart */7598: add \rp, \rp, #0xff000000 @ phys base76mrc p15, 0, \rv, c1, c077tst \rv, #1 @ MMU enabled?78ldreq \rv, =omap_uart_v2p(omap_uart_phys) @ MMU disabled79ldrne \rv, =omap_uart_phys @ MMU enabled80str \rp, [\rv, #0]81sub \rp, \rp, #0xff000000 @ phys base82add \rp, \rp, #0xfe000000 @ virt base83add \rv, \rv, #4 @ omap_uart_lsr84str \rp, [\rv, #0]85b 9b8699:87.endm8889.macro senduart,rd,rx90strb \rd, [\rx]91.endm9293.macro busyuart,rd,rx941001: ldrb \rd, [\rx, #(UART_LSR << OMAP_PORT_SHIFT)]95and \rd, \rd, #(UART_LSR_TEMT | UART_LSR_THRE)96teq \rd, #(UART_LSR_TEMT | UART_LSR_THRE)97beq 1002f98ldrb \rd, [\rx, #(UART_LSR << OMAP7XX_PORT_SHIFT)]99and \rd, \rd, #(UART_LSR_TEMT | UART_LSR_THRE)100teq \rd, #(UART_LSR_TEMT | UART_LSR_THRE)101bne 1001b1021002:103.endm104105.macro waituart,rd,rx106.endm107108109