From mboxrd@z Thu Jan 1 00:00:00 1970 From: Srinivas Kandagatla Subject: [RFC PATCH 2/2] tty:msm_serial: Do not reset IP if we use bootconsole Date: Tue, 10 Jun 2014 15:32:12 +0100 Message-ID: <1402410732-13021-1-git-send-email-srinivas.kandagatla@linaro.org> References: <1402410678-12931-1-git-send-email-srinivas.kandagatla@linaro.org> Return-path: Received: from mail-wi0-f181.google.com ([209.85.212.181]:57714 "EHLO mail-wi0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751124AbaFJOcU (ORCPT ); Tue, 10 Jun 2014 10:32:20 -0400 Received: by mail-wi0-f181.google.com with SMTP id n3so3542910wiv.2 for ; Tue, 10 Jun 2014 07:32:16 -0700 (PDT) In-Reply-To: <1402410678-12931-1-git-send-email-srinivas.kandagatla@linaro.org> Sender: linux-arm-msm-owner@vger.kernel.org List-Id: linux-arm-msm@vger.kernel.org To: linux-arm-msm@vger.kernel.org Cc: agross@codeaurora.org, Srinivas Kandagatla The use case is when we boot the platform with bootconsole enabled. What I noticed is that the console gets locked sometimes up before the bootconsole is disabled. As part of console setup in serial driver it resets that hardware which is a race condition to bootconsole using the same hardware. This patch adds a check to see if there is bootconsole before reseting the hardware. Am sure there are better ways to solve this, so marking this patch as RFC. Any suggestions are welcome. Signed-off-by: Srinivas Kandagatla --- drivers/tty/serial/msm_serial.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/drivers/tty/serial/msm_serial.c b/drivers/tty/serial/msm_serial.c index 778e376..7078153 100644 --- a/drivers/tty/serial/msm_serial.c +++ b/drivers/tty/serial/msm_serial.c @@ -913,6 +913,17 @@ static void msm_console_write(struct console *co, const char *s, spin_unlock(&port->lock); } +static int have_boot_console(void) +{ + struct console *con; + + for_each_console(con) + if (con->flags & CON_BOOT) + return 1; + + return 0; +} + static int __init msm_console_setup(struct console *co, char *options) { struct uart_port *port; @@ -943,7 +954,12 @@ static int __init msm_console_setup(struct console *co, char *options) baud = 115200; msm_set_baud_rate(port, baud); - msm_reset(port); + /* + * do not reset if we are the boot console + * can result in a lockup from bootconsole + */ + if (have_boot_console()) + msm_reset(port); if (msm_port->is_uartdm) { msm_write(port, UART_CR_CMD_PROTECTION_EN, UART_CR); -- 1.9.1