diff options
author | Laxman Dewangan <ldewangan@nvidia.com> | 2011-06-26 21:52:15 +0530 |
---|---|---|
committer | Dan Willemsen <dwillemsen@nvidia.com> | 2011-11-30 21:47:23 -0800 |
commit | dc83973f99b5567af802f70f40bcf602952f43ca (patch) | |
tree | 070f2f27c927cd9c4e58e4e354eafc69175931b4 /arch/arm/mach-tegra/board-ventana.c | |
parent | 7952212afd1566cdfebc02f55cfc3b5013ff6f0e (diff) |
arm: tegra: enterprise/ventana: debug console through device
Using the debug port device structure to enabling/configuring the
uart debug console port.
Removing the duplicate local definition of the uart console.
Original-Change-Id: Icbf954e0d02dcc4891169b3c701c72f35f8f29e3
Reviewed-on: http://git-master/r/35711
Reviewed-by: Varun Colbert <vcolbert@nvidia.com>
Tested-by: Varun Colbert <vcolbert@nvidia.com>
Rebase-Id: R74bd3a179a7ef7327397805f21389f08ac3bceb1
Diffstat (limited to 'arch/arm/mach-tegra/board-ventana.c')
-rw-r--r-- | arch/arm/mach-tegra/board-ventana.c | 104 |
1 files changed, 74 insertions, 30 deletions
diff --git a/arch/arm/mach-tegra/board-ventana.c b/arch/arm/mach-tegra/board-ventana.c index 1ed2a5637b80..31a848af7177 100644 --- a/arch/arm/mach-tegra/board-ventana.c +++ b/arch/arm/mach-tegra/board-ventana.c @@ -37,6 +37,7 @@ #include <linux/mfd/tps6586x.h> #include <linux/memblock.h> #include <linux/i2c/atmel_mxt_ts.h> +#include <linux/tegra_uart.h> #include <mach/clk.h> #include <mach/iomap.h> @@ -56,28 +57,6 @@ #include "gpio-names.h" #include "wakeups-t2.h" -static struct plat_serial8250_port debug_uart_platform_data[] = { - { - .membase = IO_ADDRESS(TEGRA_UARTD_BASE), - .mapbase = TEGRA_UARTD_BASE, - .irq = INT_UARTD, - .flags = UPF_BOOT_AUTOCONF, - .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, - }, -}; - static struct tegra_utmip_config utmi_phy_config[] = { [0] = { .hssync_start_delay = 9, @@ -138,8 +117,6 @@ static inline void ventana_bt_rfkill(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}, @@ -211,7 +188,79 @@ static void ventana_i2c_init(void) platform_device_register(&tegra_i2c_device3); platform_device_register(&tegra_i2c_device4); } +static struct platform_device *ventana_uart_devices[] __initdata = { + &tegra_uartb_device, + &tegra_uartc_device, + &tegra_uartd_device, +}; + +static struct uart_clk_parent uart_parent_clk[] = { + [0] = {.name = "pll_p"}, + [1] = {.name = "pll_m"}, + [2] = {.name = "clk_m"}, +}; + +static struct clk *debug_uart_clk; +static struct tegra_uart_platform_data ventana_uart_pdata; + +static void __init uart_debug_init(void) +{ + unsigned long rate; + struct clk *c; + + /* UARTD is the debug port. */ + pr_info("Selecting UARTD as the debug console\n"); + ventana_uart_devices[2] = &debug_uartd_device; + debug_uart_clk = clk_get_sys("serial8250.0", "uartd"); + + /* Clock enable for the debug channel */ + if (!IS_ERR_OR_NULL(debug_uart_clk)) { + rate = ((struct plat_serial8250_port *)( + debug_uartd_device.dev.platform_data))->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); + } + ventana_uart_pdata.parent_clk_list = uart_parent_clk; + ventana_uart_pdata.parent_clk_count = ARRAY_SIZE(uart_parent_clk); + tegra_uartb_device.dev.platform_data = &ventana_uart_pdata; + tegra_uartc_device.dev.platform_data = &ventana_uart_pdata; + tegra_uartd_device.dev.platform_data = &ventana_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)); +} #ifdef CONFIG_KEYBOARD_GPIO #define GPIO_KEY(_id, _gpio, _iswake) \ @@ -274,8 +323,6 @@ static struct platform_device tegra_camera = { }; static struct platform_device *ventana_devices[] __initdata = { - &tegra_uartb_device, - &tegra_uartc_device, &tegra_pmu_device, &tegra_udc_device, &tegra_ehci2_device, @@ -461,10 +508,7 @@ static void __init tegra_ventana_init(void) tegra_clk_init_from_table(ventana_clk_init_table); ventana_pinmux_init(); ventana_i2c_init(); - if (is_tegra_debug_uartport_hs() == true) - platform_device_register(&tegra_uartd_device); - else - platform_device_register(&debug_uart); + ventana_uart_init(); tegra_ehci2_device.dev.platform_data = &ventana_ehci2_ulpi_platform_data; platform_add_devices(ventana_devices, ARRAY_SIZE(ventana_devices)); |