From: Chaithrika U S <chaithr...@ti.com>

This patch defines debug macros for low-level debugging for Davinci based
platforms

Tested on :
        - DM644x DaVinci EVM
        - DM646X DaVinciHD EVM
        - DM355 EVM

This patch attempts to solve the low-level debug issue in DM646x. The UART
on DM646x SoC allows only 32-bit access. The existing debug-macro.S uses the
macros from debug-8250.S file. This led to garbage serial out in the case of
DM646x.

The inclusion of debug-8250.S does not allow for run time fix for this issue.
There are compile time errors due to multiple definitions of the macros.
Also when building a single image for multiple DaVinci Platforms, the ifdefs
cannot be relied upon.

The solution below does not include the debug-8250.S file and defines the
necessary macros. This solution was arrived at after observing that word
access does not affect the low-level debug messages on DM644x/DM355.

The other approach to this issue is to use the UART module information
available in the peripheral registers to decide the access mechanism. But this
will have to be done for every access of UART specifically for DM646x. Also
this calls for a modification of the debug-8250.S file.

Signed-off-by: Chaithrika U S <chaithr...@ti.com>
---
 arch/arm/mach-davinci/include/mach/debug-macro.S |   29 ++++++++++++++++++++-
 1 files changed, 27 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-davinci/include/mach/debug-macro.S 
b/arch/arm/mach-davinci/include/mach/debug-macro.S
index e6c0f0d..45271c9 100644
--- a/arch/arm/mach-davinci/include/mach/debug-macro.S
+++ b/arch/arm/mach-davinci/include/mach/debug-macro.S
@@ -9,6 +9,14 @@
  * or implied.
  */
 
+/* Modifications
+ * Jan 2009    Chaithrika U S  Added senduart, busyuart, waituart
+ *                             macros, based on debug-8250.S file
+ */
+
+#include <linux/serial_reg.h>
+#define UART_SHIFT     2
+
                .macro addruart, rx
                mrc     p15, 0, \rx, c1, c0
                tst     \rx, #1                 @ MMU enabled?
@@ -17,5 +25,22 @@
                orr     \rx, \rx, #0x00c20000   @ UART 0
                .endm
 
-#define UART_SHIFT     2
-#include <asm/hardware/debug-8250.S>
+               .macro  senduart,rd,rx
+               str     \rd, [\rx, #UART_TX << UART_SHIFT]
+               .endm
+
+               .macro  busyuart,rd,rx
+1002:          ldr     \rd, [\rx, #UART_LSR << UART_SHIFT]
+               and     \rd, \rd, #UART_LSR_TEMT | UART_LSR_THRE
+               teq     \rd, #UART_LSR_TEMT | UART_LSR_THRE
+               bne     1002b
+               .endm
+
+               .macro  waituart,rd,rx
+#ifdef FLOW_CONTROL
+1001:          ldr     \rd, [\rx, #UART_MSR << UART_SHIFT]
+               tst     \rd, #UART_MSR_CTS
+               beq     1001b
+#endif
+               .endm
+
-- 
1.5.4.1

_______________________________________________
Davinci-linux-open-source mailing list
Davinci-linux-open-source@linux.davincidsp.com
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source

Reply via email to