From: Andrew Morton <akpm@linux-foundation.org>
To: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Cc: linux-kernel@vger.kernel.org, ralf@linux-mips.org,
jason.wessel@windriver.com
Subject: Re: [PATCH resend] kgdb: kgdboc console poll hooks for serial_txx9 uart
Date: Thu, 19 Feb 2009 13:17:58 -0800 [thread overview]
Message-ID: <20090219131758.088381f3.akpm@linux-foundation.org> (raw)
In-Reply-To: <20090218.223641.128619445.anemo@mba.ocn.ne.jp>
On Wed, 18 Feb 2009 22:36:41 +0900 (JST)
Atsushi Nemoto <anemo@mba.ocn.ne.jp> wrote:
> Implement the serial polling hooks for the serial_txx9 uart for use
> with kgdboc.
>
> ...
>
> diff --git a/drivers/serial/serial_txx9.c b/drivers/serial/serial_txx9.c
> index 8fcb4c5..6f18215 100644
> --- a/drivers/serial/serial_txx9.c
> +++ b/drivers/serial/serial_txx9.c
> @@ -461,6 +461,94 @@ static void serial_txx9_break_ctl(struct uart_port *port, int break_state)
> spin_unlock_irqrestore(&up->port.lock, flags);
> }
>
> +#if defined(CONFIG_SERIAL_TXX9_CONSOLE) || (CONFIG_CONSOLE_POLL)
> +/*
> + * Wait for transmitter & holding register to empty
> + */
> +static void wait_for_xmitr(struct uart_txx9_port *up)
> +{
> + unsigned int tmout = 10000;
> +
> + /* Wait up to 10ms for the character(s) to be sent. */
> + while (--tmout &&
> + !(sio_in(up, TXX9_SICISR) & TXX9_SICISR_TXALS))
> + udelay(1);
> +
> + /* Wait up to 1s for flow control if necessary */
> + if (up->port.flags & UPF_CONS_FLOW) {
> + tmout = 1000000;
> + while (--tmout &&
> + (sio_in(up, TXX9_SICISR) & TXX9_SICISR_CTSS))
> + udelay(1);
> + }
> +}
> +#endif
> +
> +#ifdef CONFIG_CONSOLE_POLL
> +/*
> + * Console polling routines for writing and reading from the uart while
> + * in an interrupt or debug context.
> + */
> +
> +static int serial_txx9_get_poll_char(struct uart_port *port)
> +{
> + unsigned int ier;
> + unsigned char c;
> + struct uart_txx9_port *up = (struct uart_txx9_port *)port;
It's nicer to use container_of() for this operation.
> ...
>
> +static void serial_txx9_put_poll_char(struct uart_port *port, unsigned char c)
> +{
> + unsigned int ier;
> + struct uart_txx9_port *up = (struct uart_txx9_port *)port;
ditto.
> + /*
> + * First save the IER then disable the interrupts
> + */
> + ier = sio_in(up, TXX9_SIDICR);
> + sio_out(up, TXX9_SIDICR, 0);
> +
> + wait_for_xmitr(up);
> + /*
> + * Send the character out.
> + * If a LF, also do CR...
> + */
> + sio_out(up, TXX9_SITFIFO, c);
> + if (c == 10) {
> + wait_for_xmitr(up);
> + sio_out(up, TXX9_SITFIFO, 13);
> + }
> +
> + /*
> + * Finally, wait for transmitter to become empty
> + * and restore the IER
> + */
> + wait_for_xmitr(up);
> + sio_out(up, TXX9_SIDICR, ier);
> +}
> +
next prev parent reply other threads:[~2009-02-19 21:18 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-02-18 13:36 [PATCH resend] kgdb: kgdboc console poll hooks for serial_txx9 uart Atsushi Nemoto
2009-02-19 21:17 ` Andrew Morton [this message]
2009-02-20 15:27 ` Atsushi Nemoto
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20090219131758.088381f3.akpm@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=anemo@mba.ocn.ne.jp \
--cc=jason.wessel@windriver.com \
--cc=linux-kernel@vger.kernel.org \
--cc=ralf@linux-mips.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox