summaryrefslogtreecommitdiff
path: root/arch/arm/mach-tegra/board-cardhu.c
diff options
context:
space:
mode:
authorLaxman Dewangan <ldewangan@nvidia.com>2012-10-11 19:14:10 +0530
committerMrutyunjay Sawant <msawant@nvidia.com>2012-10-15 00:39:40 -0700
commit0fb76a18062cb2b565974c286c0154fd77aa22a0 (patch)
treec4d68169d014dbaf8fc952f60c7b484386a5cc33 /arch/arm/mach-tegra/board-cardhu.c
parent8252428617812946cb652da189e1260d30d6eeab (diff)
ARM: tegra: move uart debug port initialization into common file.
There is lots of duplicate code for initializing the debug port for all platform. Move this to board-common file so that duplicate code can be avoided. Change-Id: I3e8a10cd3db4db21d6752a0b689136bfe9828197 Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Reviewed-on: http://git-master/r/143721 Reviewed-by: Mrutyunjay Sawant <msawant@nvidia.com> Tested-by: Mrutyunjay Sawant <msawant@nvidia.com>
Diffstat (limited to 'arch/arm/mach-tegra/board-cardhu.c')
-rw-r--r--arch/arm/mach-tegra/board-cardhu.c111
1 files changed, 21 insertions, 90 deletions
diff --git a/arch/arm/mach-tegra/board-cardhu.c b/arch/arm/mach-tegra/board-cardhu.c
index 1e1f2a833b87..2584396a18e0 100644
--- a/arch/arm/mach-tegra/board-cardhu.c
+++ b/arch/arm/mach-tegra/board-cardhu.c
@@ -72,6 +72,7 @@
#include <asm/mach/arch.h>
#include "board.h"
+#include "board-common.h"
#include "clock.h"
#include "board-cardhu.h"
#include "board-touch-raydium.h"
@@ -438,28 +439,29 @@ static struct uart_clk_parent uart_parent_clk[] = {
static struct tegra_uart_platform_data cardhu_uart_pdata;
static struct tegra_uart_platform_data cardhu_loopback_uart_pdata;
-static void __init uart_debug_init(void)
+static int __init uart_debug_init(void)
{
struct board_info board_info;
int debug_port_id;
+ int default_debug_port = 0;
tegra_get_board_info(&board_info);
- debug_port_id = get_tegra_uart_debug_port_id();
- if (debug_port_id < 0) {
- debug_port_id = 0;
- /* UARTB is debug port
- * for SLT - E1186/E1187/PM269
- * for E1256/E1257
- */
- if (((board_info.sku & SKU_SLT_ULPI_SUPPORT) &&
- ((board_info.board_id == BOARD_E1186) ||
- (board_info.board_id == BOARD_E1187) ||
- (board_info.board_id == BOARD_PM269))) ||
- (board_info.board_id == BOARD_E1256) ||
- (board_info.board_id == BOARD_E1257))
- debug_port_id = 1;
- }
+ /* UARTB is debug port
+ * for SLT - E1186/E1187/PM269
+ * for E1256/E1257
+ */
+ if (((board_info.sku & SKU_SLT_ULPI_SUPPORT) &&
+ ((board_info.board_id == BOARD_E1186) ||
+ (board_info.board_id == BOARD_E1187) ||
+ (board_info.board_id == BOARD_PM269))) ||
+ (board_info.board_id == BOARD_E1256) ||
+ (board_info.board_id == BOARD_E1257))
+ default_debug_port = 1;
+
+ debug_port_id = uart_console_debug_init(default_debug_port);
+ if (debug_port_id < 0)
+ return debug_port_id;
#ifdef CONFIG_TEGRA_IRDA
if ((board_info.board_id == BOARD_E1186) ||
@@ -470,62 +472,8 @@ static void __init uart_debug_init(void)
}
}
#endif
-
- switch (debug_port_id) {
- case 0:
- /* UARTA is the debug port. */
- pr_info("Selecting UARTA as the debug console\n");
- cardhu_uart_devices[0] = &debug_uarta_device;
- debug_uart_clk = clk_get_sys("serial8250.0", "uarta");
- debug_uart_port_base = ((struct plat_serial8250_port *)(
- debug_uarta_device.dev.platform_data))->mapbase;
- break;
-
- case 1:
- /* UARTB is the debug port. */
- pr_info("Selecting UARTB as the debug console\n");
- cardhu_uart_devices[1] = &debug_uartb_device;
- debug_uart_clk = clk_get_sys("serial8250.0", "uartb");
- debug_uart_port_base = ((struct plat_serial8250_port *)(
- debug_uartb_device.dev.platform_data))->mapbase;
- break;
-
- case 2:
- /* UARTC is the debug port. */
- pr_info("Selecting UARTC as the debug console\n");
- cardhu_uart_devices[2] = &debug_uartc_device;
- debug_uart_clk = clk_get_sys("serial8250.0", "uartc");
- debug_uart_port_base = ((struct plat_serial8250_port *)(
- debug_uartc_device.dev.platform_data))->mapbase;
- break;
-
- case 3:
- /* UARTD is the debug port. */
- pr_info("Selecting UARTD as the debug console\n");
- cardhu_uart_devices[3] = &debug_uartd_device;
- debug_uart_clk = clk_get_sys("serial8250.0", "uartd");
- debug_uart_port_base = ((struct plat_serial8250_port *)(
- debug_uartd_device.dev.platform_data))->mapbase;
- break;
-
- case 4:
- /* UARTE is the debug port. */
- pr_info("Selecting UARTE as the debug console\n");
- cardhu_uart_devices[4] = &debug_uarte_device;
- debug_uart_clk = clk_get_sys("serial8250.0", "uarte");
- debug_uart_port_base = ((struct plat_serial8250_port *)(
- debug_uarte_device.dev.platform_data))->mapbase;
- break;
-
- default:
- pr_info("The debug console id %d is invalid, Assuming UARTA", debug_port_id);
- cardhu_uart_devices[0] = &debug_uarta_device;
- debug_uart_clk = clk_get_sys("serial8250.0", "uarta");
- debug_uart_port_base = ((struct plat_serial8250_port *)(
- debug_uarta_device.dev.platform_data))->mapbase;
- break;
- }
- return;
+ cardhu_uart_devices[debug_port_id] = uart_console_debug_device;
+ return debug_port_id;
}
static void __init cardhu_uart_init(void)
@@ -560,25 +508,8 @@ static void __init cardhu_uart_init(void)
tegra_uarte_device.dev.platform_data = &cardhu_loopback_uart_pdata;
/* Register low speed only if it is selected */
- if (!is_tegra_debug_uartport_hs()) {
+ if (!is_tegra_debug_uartport_hs())
uart_debug_init();
- /* Clock enable for the debug channel */
- if (!IS_ERR_OR_NULL(debug_uart_clk)) {
- pr_info("The debug console clock name is %s\n",
- debug_uart_clk->name);
- c = tegra_get_clock_by_name("pll_p");
- if (IS_ERR_OR_NULL(c))
- pr_err("Not getting the parent clock pll_p\n");
- else
- clk_set_parent(debug_uart_clk, c);
-
- clk_enable(debug_uart_clk);
- clk_set_rate(debug_uart_clk, clk_get_rate(c));
- } else {
- pr_err("Not getting the clock %s for debug console\n",
- debug_uart_clk->name);
- }
- }
#ifdef CONFIG_TEGRA_IRDA
if (((board_info.board_id == BOARD_E1186) ||