From 83ff0af39d5439225833a1170a8e18e5a058573b Mon Sep 17 00:00:00 2001
From: =?utf8?q?=E9=BB=84=E6=B6=9B?= <huangtao@rock-chips.com>
Date: Wed, 9 Jan 2013 10:05:57 +0800
Subject: [PATCH] rk30: add debug_uart.h

---
 arch/arm/mach-rk30/devices.c                 |  1 +
 arch/arm/mach-rk30/include/mach/debug_uart.h | 24 ++++++++++++++++++++
 arch/arm/mach-rk30/include/mach/io.h         | 14 ------------
 arch/arm/mach-rk30/include/mach/irqs.h       |  3 ---
 arch/arm/mach-rk30/pm.c                      |  1 +
 5 files changed, 26 insertions(+), 17 deletions(-)
 create mode 100644 arch/arm/mach-rk30/include/mach/debug_uart.h

diff --git a/arch/arm/mach-rk30/devices.c b/arch/arm/mach-rk30/devices.c
index c5e6aee6b981..42c85604129b 100755
--- a/arch/arm/mach-rk30/devices.c
+++ b/arch/arm/mach-rk30/devices.c
@@ -24,6 +24,7 @@
 #include <plat/dma-pl330.h>
 #include <mach/gpio.h>
 #include <mach/iomux.h>
+#include <mach/debug_uart.h>
 #include <plat/rk_fiq_debugger.h>
 
 #ifdef CONFIG_ADC_RK30
diff --git a/arch/arm/mach-rk30/include/mach/debug_uart.h b/arch/arm/mach-rk30/include/mach/debug_uart.h
new file mode 100644
index 000000000000..8295cfe8fb57
--- /dev/null
+++ b/arch/arm/mach-rk30/include/mach/debug_uart.h
@@ -0,0 +1,24 @@
+#ifndef __MACH_DEBUG_UART
+#define __MACH_DEBUG_UART
+
+#if CONFIG_RK_DEBUG_UART >= 0 && CONFIG_RK_DEBUG_UART < 4
+
+#if CONFIG_RK_DEBUG_UART == 0
+#define DEBUG_UART_PHYS         RK30_UART0_PHYS
+#define DEBUG_UART_BASE         RK30_UART0_BASE
+#elif CONFIG_RK_DEBUG_UART == 1
+#define DEBUG_UART_PHYS         RK30_UART1_PHYS
+#define DEBUG_UART_BASE         RK30_UART1_BASE
+#elif CONFIG_RK_DEBUG_UART == 2
+#define DEBUG_UART_PHYS         RK30_UART2_PHYS
+#define DEBUG_UART_BASE         RK30_UART2_BASE
+#elif CONFIG_RK_DEBUG_UART == 3
+#define DEBUG_UART_PHYS         RK30_UART3_PHYS
+#define DEBUG_UART_BASE         RK30_UART3_BASE
+#endif
+
+#define IRQ_DEBUG_UART		(IRQ_UART0 + CONFIG_RK_DEBUG_UART)
+
+#endif
+
+#endif
diff --git a/arch/arm/mach-rk30/include/mach/io.h b/arch/arm/mach-rk30/include/mach/io.h
index ae5dcca95bcc..dee6fe9e199f 100755
--- a/arch/arm/mach-rk30/include/mach/io.h
+++ b/arch/arm/mach-rk30/include/mach/io.h
@@ -229,20 +229,6 @@
 #define RK30_HSIC_PHYS          0x10240000
 #define RK30_HSIC_SIZE          SZ_256K
 
-#if CONFIG_RK_DEBUG_UART == 0
-#define DEBUG_UART_PHYS         RK30_UART0_PHYS
-#define DEBUG_UART_BASE         RK30_UART0_BASE
-#elif CONFIG_RK_DEBUG_UART == 1
-#define DEBUG_UART_PHYS         RK30_UART1_PHYS
-#define DEBUG_UART_BASE         RK30_UART1_BASE
-#elif CONFIG_RK_DEBUG_UART == 2
-#define DEBUG_UART_PHYS         RK30_UART2_PHYS
-#define DEBUG_UART_BASE         RK30_UART2_BASE
-#elif CONFIG_RK_DEBUG_UART == 3
-#define DEBUG_UART_PHYS         RK30_UART3_PHYS
-#define DEBUG_UART_BASE         RK30_UART3_BASE
-#endif
-
 #define GIC_DIST_BASE           RK30_GICD_BASE
 #define GIC_CPU_BASE            RK30_GICC_BASE
 
diff --git a/arch/arm/mach-rk30/include/mach/irqs.h b/arch/arm/mach-rk30/include/mach/irqs.h
index 73f6f10f5f80..0d5369e5a8e1 100644
--- a/arch/arm/mach-rk30/include/mach/irqs.h
+++ b/arch/arm/mach-rk30/include/mach/irqs.h
@@ -88,9 +88,6 @@
 
 //hhb@rock-chips.com this spi is used for fiq_debugger signal irq
 #define IRQ_UART_SIGNAL			RK30XX_IRQ(80)
-#if CONFIG_RK_DEBUG_UART >= 0 && CONFIG_RK_DEBUG_UART < 4
-#define IRQ_DEBUG_UART			(IRQ_UART0 + CONFIG_RK_DEBUG_UART)
-#endif
 
 #define IRQ_ARM_PMU                     RK30XX_IRQ(103)
 
diff --git a/arch/arm/mach-rk30/pm.c b/arch/arm/mach-rk30/pm.c
index 9ab51da4b473..218f1af8dd1a 100755
--- a/arch/arm/mach-rk30/pm.c
+++ b/arch/arm/mach-rk30/pm.c
@@ -22,6 +22,7 @@
 #include <mach/iomux.h>
 #include <mach/cru.h>
 #include <mach/ddr.h>
+#include <mach/debug_uart.h>
 
 #define cru_readl(offset)	readl_relaxed(RK30_CRU_BASE + offset)
 #define cru_writel(v, offset)	do { writel_relaxed(v, RK30_CRU_BASE + offset); dsb(); } while (0)
-- 
2.34.1