[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAL_JsqK0hPtoD22fw3J+TmgNwJeJUYwjB9i1C4n817GvuOxQxw@mail.gmail.com>
Date: Thu, 17 Oct 2013 14:16:37 -0500
From: Rob Herring <robherring2@...il.com>
To: "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linux-arm-kernel@...ts.infradead.org"
<linux-arm-kernel@...ts.infradead.org>
Cc: Rob Herring <rob.herring@...xeda.com>,
Paolo Pisati <paolo.pisati@...onical.com>,
Tim Gardner <tim.gardner@...onical.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Jiri Slaby <jslaby@...e.cz>
Subject: Re: [PATCH v2] TTY: hvc_dcc: probe for a JTAG connection before registering
On Tue, Sep 24, 2013 at 9:05 PM, Rob Herring <robherring2@...il.com> wrote:
> From: Rob Herring <rob.herring@...xeda.com>
>
> Enabling the ARM DCC console and using without a JTAG connection will
> simply hang the system. Since distros like to turn on all options, this
> is a reoccurring problem to debug. We can do better by checking if
> anything is attached and handling characters. There is no way to probe
> this, so send a newline and check that it is handled.
>
> Cc: Paolo Pisati <paolo.pisati@...onical.com>
> Cc: Tim Gardner <tim.gardner@...onical.com>
> Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
> Cc: Jiri Slaby <jslaby@...e.cz>
> Signed-off-by: Rob Herring <rob.herring@...xeda.com>
> ---
> v2: use time_is_after_jiffies
>
> drivers/tty/hvc/hvc_dcc.c | 21 +++++++++++++++++++++
> 1 file changed, 21 insertions(+)
Greg, Jiri,
Can you please apply.
Rob
>
> diff --git a/drivers/tty/hvc/hvc_dcc.c b/drivers/tty/hvc/hvc_dcc.c
> index 44fbeba..3502a7b 100644
> --- a/drivers/tty/hvc/hvc_dcc.c
> +++ b/drivers/tty/hvc/hvc_dcc.c
> @@ -86,6 +86,21 @@ static int hvc_dcc_get_chars(uint32_t vt, char *buf, int count)
> return i;
> }
>
> +static bool hvc_dcc_check(void)
> +{
> + unsigned long time = jiffies + (HZ / 10);
> +
> + /* Write a test character to check if it is handled */
> + __dcc_putchar('\n');
> +
> + while (time_is_after_jiffies(time)) {
> + if (!(__dcc_getstatus() & DCC_STATUS_TX))
> + return true;
> + }
> +
> + return false;
> +}
> +
> static const struct hv_ops hvc_dcc_get_put_ops = {
> .get_chars = hvc_dcc_get_chars,
> .put_chars = hvc_dcc_put_chars,
> @@ -93,6 +108,9 @@ static const struct hv_ops hvc_dcc_get_put_ops = {
>
> static int __init hvc_dcc_console_init(void)
> {
> + if (!hvc_dcc_check())
> + return -ENODEV;
> +
> hvc_instantiate(0, 0, &hvc_dcc_get_put_ops);
> return 0;
> }
> @@ -100,6 +118,9 @@ console_initcall(hvc_dcc_console_init);
>
> static int __init hvc_dcc_init(void)
> {
> + if (!hvc_dcc_check())
> + return -ENODEV;
> +
> hvc_alloc(0, 0, &hvc_dcc_get_put_ops, 128);
> return 0;
> }
> --
> 1.8.1.2
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists