summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaxman Dewangan <ldewangan@nvidia.com>2011-06-26 22:53:26 +0530
committerRohan Somvanshi <rsomvanshi@nvidia.com>2011-06-29 06:50:11 -0700
commit7dd8a41c90a0c26a8aa058a033e82b5428893925 (patch)
treefd0730a09de76b4fc9cb99f701cbecab5877e5c8
parent183b719ce93a037ddb4fbedcf0d91341424235ba (diff)
arm: tegra: ventana: Add board entry for uart.
Adding the uart initialization as separate function and handling the clock and device registration. It also provides all possible clock source and their handle to driver so that driver can use this clock information to select baud rate dynamically. bug 842665 Change-Id: Ib5ec368b8ceb2df47f48f72aefee4af1b113b913 Reviewed-on: http://git-master/r/38428 Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com> Tested-by: Laxman Dewangan <ldewangan@nvidia.com> Reviewed-by: Bitan Biswas <bbiswas@nvidia.com>
-rw-r--r--arch/arm/mach-tegra/board-ventana.c83
1 files changed, 75 insertions, 8 deletions
diff --git a/arch/arm/mach-tegra/board-ventana.c b/arch/arm/mach-tegra/board-ventana.c
index 329fb7c65a46..31e4cae37171 100644
--- a/arch/arm/mach-tegra/board-ventana.c
+++ b/arch/arm/mach-tegra/board-ventana.c
@@ -36,6 +36,7 @@
#include <linux/usb/android_composite.h>
#include <linux/mfd/tps6586x.h>
#include <linux/memblock.h>
+#include <linux/tegra_uart.h>
#ifdef CONFIG_TOUCHSCREEN_PANJIT_I2C
#include <linux/i2c/panjit_ts.h>
@@ -105,6 +106,79 @@ static struct platform_device debug_uart = {
.platform_data = debug_uart_platform_data,
},
};
+static struct platform_device *ventana_uart_devices[] __initdata = {
+ &tegra_uartb_device,
+ &tegra_uartc_device,
+ &tegra_uartd_device,
+};
+
+struct uart_clk_parent uart_parent_clk[] = {
+ [0] = {.name = "pll_p"},
+ [1] = {.name = "pll_m"},
+ [2] = {.name = "clk_m"},
+};
+
+static struct tegra_uart_platform_data cardhu_uart_pdata;
+
+static void __init uart_debug_init(void)
+{
+ unsigned long rate;
+ static struct clk *debug_uart_clk;
+ struct clk *c;
+
+ /* UARTD is the debug port. */
+ pr_info("Selecting UARTD as the debug console\n");
+ ventana_uart_devices[2] = &debug_uart;
+ debug_uart_clk = clk_get_sys("serial8250.0", "uartd");
+
+ /* Clock enable for the debug channel */
+ if (!IS_ERR_OR_NULL(debug_uart_clk)) {
+ rate = debug_uart_platform_data[0].uartclk;
+ 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, rate);
+ } else {
+ pr_err("Not getting the clock %s for debug console\n",
+ debug_uart_clk->name);
+ }
+}
+
+static void __init ventana_uart_init(void)
+{
+ int i;
+ struct clk *c;
+
+ for (i = 0; i < ARRAY_SIZE(uart_parent_clk); ++i) {
+ c = tegra_get_clock_by_name(uart_parent_clk[i].name);
+ if (IS_ERR_OR_NULL(c)) {
+ pr_err("Not able to get the clock for %s\n",
+ uart_parent_clk[i].name);
+ continue;
+ }
+ uart_parent_clk[i].parent_clk = c;
+ uart_parent_clk[i].fixed_clk_rate = clk_get_rate(c);
+ }
+ cardhu_uart_pdata.parent_clk_list = uart_parent_clk;
+ cardhu_uart_pdata.parent_clk_count = ARRAY_SIZE(uart_parent_clk);
+
+ tegra_uartb_device.dev.platform_data = &cardhu_uart_pdata;
+ tegra_uartc_device.dev.platform_data = &cardhu_uart_pdata;
+ tegra_uartd_device.dev.platform_data = &cardhu_uart_pdata;
+
+ /* Register low speed only if it is selected */
+ if (!is_tegra_debug_uartport_hs())
+ uart_debug_init();
+
+ platform_add_devices(ventana_uart_devices,
+ ARRAY_SIZE(ventana_uart_devices));
+}
static struct tegra_audio_platform_data tegra_spdif_pdata = {
.dma_on = true, /* use dma by default */
@@ -230,8 +304,6 @@ static inline void tegra_setup_bluesleep(void) { }
static __initdata struct tegra_clk_init_table ventana_clk_init_table[] = {
/* name parent rate enabled */
- { "uartd", "pll_p", 216000000, true},
- { "uartc", "pll_m", 600000000, false},
{ "blink", "clk_32k", 32768, false},
{ "pll_p_out4", "pll_p", 24000000, true },
{ "pwm", "clk_32k", 32768, false},
@@ -601,8 +673,6 @@ static struct platform_device tegra_camera = {
static struct platform_device *ventana_devices[] __initdata = {
&tegra_usb_fsg_device,
&androidusb_device,
- &tegra_uartb_device,
- &tegra_uartc_device,
&pmu_device,
&tegra_udc_device,
&tegra_ehci2_device,
@@ -853,15 +923,12 @@ static void __init tegra_ventana_init(void)
tegra_clk_init_from_table(ventana_clk_init_table);
ventana_pinmux_init();
ventana_i2c_init();
+ ventana_uart_init();
snprintf(usb_serial_num, sizeof(usb_serial_num), "%llx", tegra_chip_uid());
andusb_plat.serial_number = kstrdup(usb_serial_num, GFP_KERNEL);
tegra_i2s_device1.dev.platform_data = &tegra_audio_pdata[0];
tegra_i2s_device2.dev.platform_data = &tegra_audio_pdata[1];
tegra_spdif_device.dev.platform_data = &tegra_spdif_pdata;
- if (is_tegra_debug_uartport_hs() == true)
- platform_device_register(&tegra_uartd_device);
- else
- platform_device_register(&debug_uart);
tegra_das_device.dev.platform_data = &tegra_das_pdata;
tegra_ehci2_device.dev.platform_data
= &ventana_ehci2_ulpi_platform_data;