Simplified UART base address calculation for low-level debug macros.  This
makes it much easier to add in support for other SOCs.

Signed-off-by: Cyril Chemparathy <[email protected]>
---
 arch/arm/mach-davinci/include/mach/debug-macro.S |   28 +++++++++++++--------
 arch/arm/mach-davinci/include/mach/hardware.h    |    4 ++-
 arch/arm/mach-davinci/include/mach/serial.h      |    2 +
 3 files changed, 22 insertions(+), 12 deletions(-)

diff --git a/arch/arm/mach-davinci/include/mach/debug-macro.S 
b/arch/arm/mach-davinci/include/mach/debug-macro.S
index 3cd93a8..b8b47a4 100644
--- a/arch/arm/mach-davinci/include/mach/debug-macro.S
+++ b/arch/arm/mach-davinci/include/mach/debug-macro.S
@@ -17,22 +17,28 @@
  */
 
 #include <linux/serial_reg.h>
+#include <mach/serial.h>
+
+#if defined(CONFIG_ARCH_DAVINCI_DMx)
+#define UART_PHYS      DAVINCI_UART0_BASE
+#define UART_VIRT      IO_ADDRESS(UART_PHYS)
+#endif
+
+#if defined(CONFIG_ARCH_DAVINCI_DA8XX)
+#ifdef UART_PHYS
+#error "CONFIG_DEBUG_LL is incompatible with multiple archs"
+#endif
+#define UART_PHYS      DA8XX_UART2_BASE
+#define UART_VIRT      IO_ADDRESS(UART_PHYS)
+#endif
+
 #define UART_SHIFT     2
 
                .macro addruart, rx, tmp
                mrc     p15, 0, \rx, c1, c0
                tst     \rx, #1                 @ MMU enabled?
-               moveq   \rx, #0x01000000        @ physical base address
-               movne   \rx, #0xfe000000        @ virtual base
-#if defined(CONFIG_ARCH_DAVINCI_DA8XX) && defined(CONFIG_ARCH_DAVINCI_DMx)
-#error Cannot enable DaVinci and DA8XX platforms concurrently
-#elif defined(CONFIG_MACH_DAVINCI_DA830_EVM) || \
-       defined(CONFIG_MACH_DAVINCI_DA850_EVM)
-               orr     \rx, \rx, #0x00d00000   @ physical base address
-               orr     \rx, \rx, #0x0000d000   @ of UART 2
-#else
-               orr     \rx, \rx, #0x00c20000   @ UART 0
-#endif
+               ldreq   \rx, =UART_PHYS
+               ldrne   \rx, =UART_VIRT
                .endm
 
                .macro  senduart,rd,rx
diff --git a/arch/arm/mach-davinci/include/mach/hardware.h 
b/arch/arm/mach-davinci/include/mach/hardware.h
index c45ba1f..85dd2b8 100644
--- a/arch/arm/mach-davinci/include/mach/hardware.h
+++ b/arch/arm/mach-davinci/include/mach/hardware.h
@@ -11,6 +11,8 @@
 #ifndef __ASM_ARCH_HARDWARE_H
 #define __ASM_ARCH_HARDWARE_H
 
+#include <linux/const.h>
+
 /*
  * Before you add anything to ths file:
  *
@@ -27,7 +29,7 @@
 /*
  * I/O mapping
  */
-#define IO_PHYS                                0x01c00000UL
+#define IO_PHYS                                _AC(0x01c00000, UL)
 #define IO_OFFSET                      0xfd000000 /* Virtual IO = 0xfec00000 */
 #define IO_SIZE                                0x00400000
 #define IO_VIRT                                (IO_PHYS + IO_OFFSET)
diff --git a/arch/arm/mach-davinci/include/mach/serial.h 
b/arch/arm/mach-davinci/include/mach/serial.h
index 7eacbc0..8f97d03 100644
--- a/arch/arm/mach-davinci/include/mach/serial.h
+++ b/arch/arm/mach-davinci/include/mach/serial.h
@@ -31,11 +31,13 @@
 #define UART_DM646X_SCR                        0x10
 #define UART_DM646X_SCR_TX_WATERMARK   0x08
 
+#ifndef __ASSEMBLY__
 struct davinci_uart_config {
        /* Bit field of UARTs present; bit 0 --> UART1 */
        unsigned int enabled_uarts;
 };
 
 extern int davinci_serial_init(struct davinci_uart_config *);
+#endif
 
 #endif /* __ASM_ARCH_SERIAL_H */
-- 
1.6.3.3

_______________________________________________
Davinci-linux-open-source mailing list
[email protected]
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source

Reply via email to