diff options
author | Govindraj.R <govindraj.raja@ti.com> | 2011-09-21 07:24:12 -0400 |
---|---|---|
committer | Kevin Hilman <khilman@ti.com> | 2011-12-14 19:05:26 -0500 |
commit | 36fc2d15b120ef85be74c68b5ad74ac04fbefa8a (patch) | |
tree | 208dfab0524b24860414c6368c8544e6050b4dfa /arch/arm/mach-omap2/serial.c | |
parent | 08f86b3eab9807e6d36de7e00025abad893ff557 (diff) |
ARM: OMAP2+: UART: Do not gate uart clocks if used for debug_prints
If OMAP UART is used as console uart and debug is enabled,
avoid gating of uart clocks to print all debug prints.
If uart clocks are gated then the debug prints from omap_device
framework or hwmod framework can cause uart to enter recursive
pm_runtime calls, which can cause a deadlock over power lock usage.
For example: Say, uart clocks are cut and we get a print from
omap_device_disable stating disabling uart clocks. This print
calls omap_uart driver console_write which will call runtime API
get_sync which means we enter from runtime API put context to
runtime API get context.
--> runtime put (take power lock)
--> print disabling uart clocks
--> call uart console write
--> call get_sync (try to take power lock)
Also any clock enable API call from uart driver should not call any uart
operation until clocks are enabled back. Like get_sync having debug print
calling uart console write even before clocks are enabled.
So to avoid these scenarios, identify from bootargs if OMAP_UART(ttyO) is used
in debug mode. If so, do not set device_may_wakeup. This will prevent
pm_runtime_enable in uart driver and will avoid uart clock gating.
Debug is enabled either by adding debug word in bootarg or by setting
loglevel=10
Signed-off-by: Govindraj.R <govindraj.raja@ti.com>
Signed-off-by: Kevin Hilman <khilman@ti.com>
Diffstat (limited to 'arch/arm/mach-omap2/serial.c')
-rw-r--r-- | arch/arm/mach-omap2/serial.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/arch/arm/mach-omap2/serial.c b/arch/arm/mach-omap2/serial.c index 6c8135a9d35d..c909770eacd1 100644 --- a/arch/arm/mach-omap2/serial.c +++ b/arch/arm/mach-omap2/serial.c | |||
@@ -65,6 +65,7 @@ static LIST_HEAD(uart_list); | |||
65 | static u8 num_uarts; | 65 | static u8 num_uarts; |
66 | static u8 console_uart_id = -1; | 66 | static u8 console_uart_id = -1; |
67 | static u8 no_console_suspend; | 67 | static u8 no_console_suspend; |
68 | static u8 uart_debug; | ||
68 | 69 | ||
69 | #define DEFAULT_RXDMA_POLLRATE 1 /* RX DMA polling rate (us) */ | 70 | #define DEFAULT_RXDMA_POLLRATE 1 /* RX DMA polling rate (us) */ |
70 | #define DEFAULT_RXDMA_BUFSIZE 4096 /* RX DMA buffer size */ | 71 | #define DEFAULT_RXDMA_BUFSIZE 4096 /* RX DMA buffer size */ |
@@ -300,6 +301,13 @@ static int __init omap_serial_early_init(void) | |||
300 | if (cmdline_find_option(uart_name)) { | 301 | if (cmdline_find_option(uart_name)) { |
301 | console_uart_id = uart->num; | 302 | console_uart_id = uart->num; |
302 | 303 | ||
304 | if (console_loglevel >= 10) { | ||
305 | uart_debug = true; | ||
306 | pr_info("%s used as console in debug mode" | ||
307 | " uart%d clocks will not be" | ||
308 | " gated", uart_name, uart->num); | ||
309 | } | ||
310 | |||
303 | if (cmdline_find_option("no_console_suspend")) | 311 | if (cmdline_find_option("no_console_suspend")) |
304 | no_console_suspend = true; | 312 | no_console_suspend = true; |
305 | 313 | ||
@@ -399,7 +407,8 @@ void __init omap_serial_init_port(struct omap_board_data *bdata, | |||
399 | 407 | ||
400 | oh->dev_attr = uart; | 408 | oh->dev_attr = uart; |
401 | 409 | ||
402 | if ((cpu_is_omap34xx() || cpu_is_omap44xx()) && bdata->pads) | 410 | if (((cpu_is_omap34xx() || cpu_is_omap44xx()) && bdata->pads) |
411 | && !uart_debug) | ||
403 | device_init_wakeup(&pdev->dev, true); | 412 | device_init_wakeup(&pdev->dev, true); |
404 | } | 413 | } |
405 | 414 | ||