From: 黄涛 <huangtao@rock-chips.com>
Date: Thu, 15 Mar 2012 08:02:21 +0000 (+0800)
Subject: rk30: fiq debuger: rk_serial_debug_init use uart virtual address directly, do not... 
X-Git-Tag: firefly_0821_release~9595^2~60
X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=d00be0d79bb62a3c7f1a6412e799c701f12fa439;p=firefly-linux-kernel-4.4.55.git

rk30: fiq debuger: rk_serial_debug_init use uart virtual address directly, do not double map registers
---

diff --git a/arch/arm/mach-rk30/devices.c b/arch/arm/mach-rk30/devices.c
index c5c5936f57e1..402c04da7ae4 100755
--- a/arch/arm/mach-rk30/devices.c
+++ b/arch/arm/mach-rk30/devices.c
@@ -1024,7 +1024,7 @@ static int __init rk30_init_devices(void)
 #endif
 	rk30_init_sdmmc();
 #if defined(CONFIG_FIQ_DEBUGGER) && defined(DEBUG_UART_PHYS)
-	rk_serial_debug_init(DEBUG_UART_PHYS, IRQ_UART0 + CONFIG_RK_DEBUG_UART, IRQ_UART_SIGNAL, -1);
+	rk_serial_debug_init(DEBUG_UART_BASE, IRQ_UART0 + CONFIG_RK_DEBUG_UART, IRQ_UART_SIGNAL, -1);
 #endif
 	rk30_init_i2s();
         return 0;
diff --git a/arch/arm/plat-rk/include/plat/rk_fiq_debugger.h b/arch/arm/plat-rk/include/plat/rk_fiq_debugger.h
index c1ff163208c3..5c85c0794123 100644
--- a/arch/arm/plat-rk/include/plat/rk_fiq_debugger.h
+++ b/arch/arm/plat-rk/include/plat/rk_fiq_debugger.h
@@ -1,27 +1,10 @@
-/*
- * linux/arch/arm/mach-rk30/include/mach/rk30_fiq_debugger.h
- *
- * Copyright (C) 2010 Google, Inc.
- *
- * This software is licensed under the terms of the GNU General Public
- * License version 2, as published by the Free Software Foundation, and
- * may be copied, distributed, and modified under those terms.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- */
+#ifndef __PLAT_RK_FIQ_DEBUGGER_H
+#define __PLAT_RK_FIQ_DEBUGGER_H
 
-#ifndef __MACH_RK30_FIQ_DEBUGGER_H
-#define __MACH_RK30_FIQ_DEBUGGER_H
-
-//#ifdef CONFIG_RK30_FIQ_DEBUGGER
 #ifdef CONFIG_FIQ_DEBUGGER
-void rk_serial_debug_init(unsigned int base, int irq, int signal, int wakeup_irq);
+void rk_serial_debug_init(void __iomem *base, int irq, int signal_irq, int wakeup_irq);
 #else
-static inline void rk_serial_debug_init(unsigned int base, int irq, int signal, int wakeup_irq)
+static inline void rk_serial_debug_init(void __iomem *base, int irq, int signal_irq, int wakeup_irq)
 {
 }
 #endif
diff --git a/arch/arm/plat-rk/rk_fiq_debugger.c b/arch/arm/plat-rk/rk_fiq_debugger.c
index 2105af62c9f8..86c24a48dd22 100644
--- a/arch/arm/plat-rk/rk_fiq_debugger.c
+++ b/arch/arm/plat-rk/rk_fiq_debugger.c
@@ -1,8 +1,9 @@
 /*
- * arch/arm/mach-rk/rk_fiq_debugger.c
+ * arch/arm/plat-rk/rk_fiq_debugger.c
  *
  * Serial Debugger Interface for Rockchip
  *
+ * Copyright (C) 2012 ROCKCHIP, Inc.
  * Copyright (C) 2008 Google, Inc.
  *
  * This software is licensed under the terms of the GNU General Public
@@ -131,13 +132,18 @@ static void force_irq(struct platform_device *pdev, unsigned int irq)
 
 static int rk_fiq_debugger_id;
 
-void rk_serial_debug_init(unsigned int base, int irq, int signal, int wakeup_irq)
+void rk_serial_debug_init(void __iomem *base, int irq, int signal_irq, int wakeup_irq)
 {
 	struct rk_fiq_debugger *t = NULL;
 	struct platform_device *pdev = NULL;
 	struct resource *res = NULL;
 	int res_count = 0;
 
+	if (!base) {
+		pr_err("Invalid fiq debugger uart base\n");
+		return;
+	}
+
 	t = kzalloc(sizeof(struct rk_fiq_debugger), GFP_KERNEL);
 	if (!t) {
 		pr_err("Failed to allocate for fiq debugger\n");
@@ -150,12 +156,7 @@ void rk_serial_debug_init(unsigned int base, int irq, int signal, int wakeup_irq
 	t->pdata.uart_flush = debug_flush;
 	t->pdata.fiq_enable = fiq_enable;
 	t->pdata.force_irq = force_irq;
-	t->debug_port_base = ioremap(base, PAGE_SIZE);
-
-	if (!t->debug_port_base) {
-		pr_err("Failed to ioremap for fiq debugger\n");
-		goto out1;
-	}
+	t->debug_port_base = base;
 
 	res = kzalloc(sizeof(struct resource) * 3, GFP_KERNEL);
 	if (!res) {
@@ -169,7 +170,7 @@ void rk_serial_debug_init(unsigned int base, int irq, int signal, int wakeup_irq
 		goto out3;
 	};
 
-	if(irq >= 0){
+	if (irq >= 0) {
 		res[0].flags = IORESOURCE_IRQ;
 		res[0].start = irq;
 		res[0].end = irq;
@@ -177,10 +178,10 @@ void rk_serial_debug_init(unsigned int base, int irq, int signal, int wakeup_irq
 		res_count++;
 	}
 
-	if(signal >= 0){
+	if (signal_irq >= 0) {
 		res[1].flags = IORESOURCE_IRQ;
-		res[1].start = signal;
-		res[1].end = signal;
+		res[1].start = signal_irq;
+		res[1].end = signal_irq;
 		res[1].name = "signal";
 		res_count++;
 	}
@@ -209,7 +210,5 @@ out4:
 out3:
 	kfree(res);
 out2:
-	iounmap(t->debug_port_base);
-out1:
 	kfree(t);
 }