summaryrefslogtreecommitdiff
path: root/arch/arm/mach-tegra/board-cardhu.c
diff options
context:
space:
mode:
authorLaxman Dewangan <ldewangan@nvidia.com>2011-06-04 08:05:55 +0530
committerNiket Sirsi <nsirsi@nvidia.com>2011-06-06 18:35:12 -0700
commitbc71f34360b2ac7c9759d3af4e214210285ab5a3 (patch)
tree15434ca542d010364d4a5e93006bb4c64345ed97 /arch/arm/mach-tegra/board-cardhu.c
parente0ec2660057b8e0f986fb0e3859bcf59b358ef41 (diff)
arm: tegra: cardhu: Making selection of debug port dynamically.
Handling the uart device initialization in separate init call so that it will be easy to select the debug console based on board id. For E1186/E1187/PM269 with SKU-1002 enabling the UARTB as console channel. For other cases, debug channel will remain as UARTA. bug 832273 Change-Id: I924085fbb05ed749d817584644342ee5d7104274 Reviewed-on: http://git-master/r/34468 Reviewed-by: Niket Sirsi <nsirsi@nvidia.com> Tested-by: Niket Sirsi <nsirsi@nvidia.com>
Diffstat (limited to 'arch/arm/mach-tegra/board-cardhu.c')
-rw-r--r--arch/arm/mach-tegra/board-cardhu.c91
1 files changed, 57 insertions, 34 deletions
diff --git a/arch/arm/mach-tegra/board-cardhu.c b/arch/arm/mach-tegra/board-cardhu.c
index 1cd9c92f82bf..dc11ef92ac34 100644
--- a/arch/arm/mach-tegra/board-cardhu.c
+++ b/arch/arm/mach-tegra/board-cardhu.c
@@ -71,29 +71,6 @@ static struct platform_device tegra_usb_fsg_device = {
},
};
-static struct plat_serial8250_port debug_uart_platform_data[] = {
- {
- .membase = IO_ADDRESS(TEGRA_UARTA_BASE),
- .mapbase = TEGRA_UARTA_BASE,
- .irq = INT_UARTA,
- .flags = UPF_BOOT_AUTOCONF | UPF_FIXED_TYPE,
- .type = PORT_TEGRA,
- .iotype = UPIO_MEM,
- .regshift = 2,
- .uartclk = 216000000,
- }, {
- .flags = 0,
- }
-};
-
-static struct platform_device debug_uart = {
- .name = "serial8250",
- .id = PLAT8250_DEV_PLATFORM,
- .dev = {
- .platform_data = debug_uart_platform_data,
- },
-};
-
/* !!!TODO: Change for cardhu (Taken from Ventana) */
static struct tegra_utmip_config utmi_phy_config[] = {
[0] = {
@@ -211,11 +188,6 @@ static inline void tegra_setup_bluesleep(void) { }
static __initdata struct tegra_clk_init_table cardhu_clk_init_table[] = {
/* name parent rate enabled */
- { "uarta", "pll_p", 216000000, true},
- { "uartb", "pll_p", 216000000, false},
- { "uartc", "pll_p", 216000000, false},
- { "uartd", "pll_p", 216000000, false},
- { "uarte", "pll_p", 216000000, false},
{ "pll_m", NULL, 0, true},
{ "hda", "pll_p", 108000000, false},
{ "hda2codec_2x","pll_p", 48000000, false},
@@ -442,7 +414,7 @@ static void cardhu_i2c_init(void)
tegra_i2c_device4.dev.platform_data = &cardhu_i2c4_platform_data;
tegra_i2c_device5.dev.platform_data = &cardhu_i2c5_platform_data;
- // setting audio codec on i2c_4
+ /* setting audio codec on i2c_4 */
i2c_register_board_info(4, cardhu_i2c_bus1_board_info, 1);
platform_device_register(&tegra_i2c_device5);
@@ -452,6 +424,61 @@ static void cardhu_i2c_init(void)
platform_device_register(&tegra_i2c_device1);
}
+static struct platform_device *cardhu_uart_devices[] __initdata = {
+ &tegra_uarta_device,
+ &tegra_uartb_device,
+ &tegra_uartc_device,
+ &tegra_uartd_device,
+ &tegra_uarte_device,
+};
+static struct clk *debug_uart_clk;
+
+static void __init uart_debug_init(void)
+{
+ struct board_info board_info;
+
+ tegra_get_board_info(&board_info);
+ if (board_info.sku & SKU_SLT_ULPI_SUPPORT) {
+ if ((board_info.board_id == BOARD_E1186) ||
+ (board_info.board_id == BOARD_E1187) ||
+ (board_info.board_id == BOARD_PM269)) {
+ /* 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");
+ return;
+ }
+ pr_err("%s(): Unhandled SKU information for Board 0x%04x\n",
+ __func__, board_info.board_id);
+ }
+ /* 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");
+}
+
+static void __init cardhu_uart_init(void)
+{
+ /* Register low speed only if it is selected */
+ 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);
+ clk_enable(debug_uart_clk);
+ clk_set_rate(debug_uart_clk, 216000000);
+ } else {
+ pr_err("Not getting the clock %s for debug console\n",
+ debug_uart_clk->name);
+ }
+ }
+
+ platform_add_devices(cardhu_uart_devices,
+ ARRAY_SIZE(cardhu_uart_devices));
+}
+
#if defined(CONFIG_RTC_DRV_TEGRA)
static struct resource tegra_rtc_resources[] = {
[0] = {
@@ -510,11 +537,6 @@ static struct platform_device tegra_camera = {
};
static struct platform_device *cardhu_devices[] __initdata = {
- &debug_uart,
- &tegra_uartb_device,
- &tegra_uartc_device,
- &tegra_uartd_device,
- &tegra_uarte_device,
&pmu_device,
#if defined(CONFIG_RTC_DRV_TEGRA)
&tegra_rtc_device,
@@ -711,6 +733,7 @@ static void __init tegra_cardhu_init(void)
#ifdef CONFIG_TEGRA_EDP_LIMITS
cardhu_edp_init();
#endif
+ cardhu_uart_init();
snprintf(usb_serial_num, sizeof(usb_serial_num), "%llx", tegra_chip_uid());
andusb_plat.serial_number = kstrdup(usb_serial_num, GFP_KERNEL);
platform_add_devices(cardhu_devices, ARRAY_SIZE(cardhu_devices));