From: Ionut Nicu <ionut.nicu@mindbit.ro>
To: Cosmin Cojocar <cosmin.cojocar@gmail.com>
Cc: govindraj.raja@ti.com, manjugk@ti.com,
khilman@deeprootsystems.com, ben-linux@fluff.org,
tklauser@distanz.ch, feng.tang@intel.com, gregkh@suse.de,
alan@linux.intel.com, linux-omap@vger.kernel.org
Subject: Re: [PATCH 1/1] serial: omap-serial: Add support for kernel debugger
Date: Sun, 21 Nov 2010 12:56:15 +0200 [thread overview]
Message-ID: <1290336975.26899.16.camel@atlantis.mindbit.ro> (raw)
In-Reply-To: <1290286296-3589-1-git-send-email-cosmin.cojocar@gmail.com>
Hi Cosmin,
On Sat, 2010-11-20 at 21:51 +0100, Cosmin Cojocar wrote:
> The kgdb invokes the poll_put_char and poll_get_char when communicating
> with the host. This patch also changes the initialization order because the
> kgdb will check at the very beginning, if there is a valid serial
> driver.
>
> Signed-off-by: Cosmin Cojocar <cosmin.cojocar@gmail.com>
> ---
> drivers/serial/Makefile | 2 +-
> drivers/serial/omap-serial.c | 38 ++++++++++++++++++++++++++++++++++++--
> 2 files changed, 37 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/serial/Makefile b/drivers/serial/Makefile
> index c570576..ad86113 100644
> --- a/drivers/serial/Makefile
> +++ b/drivers/serial/Makefile
> @@ -80,6 +80,7 @@ obj-$(CONFIG_SERIAL_NETX) += netx-serial.o
> obj-$(CONFIG_SERIAL_OF_PLATFORM) += of_serial.o
> obj-$(CONFIG_SERIAL_OF_PLATFORM_NWPSERIAL) += nwpserial.o
> obj-$(CONFIG_SERIAL_KS8695) += serial_ks8695.o
> +obj-$(CONFIG_SERIAL_OMAP) += omap-serial.o
> obj-$(CONFIG_KGDB_SERIAL_CONSOLE) += kgdboc.o
> obj-$(CONFIG_SERIAL_QE) += ucc_uart.o
> obj-$(CONFIG_SERIAL_TIMBERDALE) += timbuart.o
> @@ -88,4 +89,3 @@ obj-$(CONFIG_SERIAL_ALTERA_JTAGUART) += altera_jtaguart.o
> obj-$(CONFIG_SERIAL_ALTERA_UART) += altera_uart.o
> obj-$(CONFIG_SERIAL_MRST_MAX3110) += mrst_max3110.o
> obj-$(CONFIG_SERIAL_MFD_HSU) += mfd.o
> -obj-$(CONFIG_SERIAL_OMAP) += omap-serial.o
> diff --git a/drivers/serial/omap-serial.c b/drivers/serial/omap-serial.c
> index 03a96db..df6ba03 100644
> --- a/drivers/serial/omap-serial.c
> +++ b/drivers/serial/omap-serial.c
> @@ -866,14 +866,44 @@ serial_omap_type(struct uart_port *port)
> return up->name;
> }
>
> +#define BOTH_EMPTY (UART_LSR_TEMT | UART_LSR_THRE)
> +
> +#ifdef CONFIG_CONSOLE_POLL
> +static void serial_omap_poll_put_char(struct uart_port *port, unsigned char ch)
> +{
> + struct uart_omap_port *up = (struct uart_omap_port *)port;
> + unsigned int status;
> +
> + do {
> + status = serial_in(up, UART_LSR);
> + udelay(1);
> + } while ((status & BOTH_EMPTY) != BOTH_EMPTY);
> +
Shouldn't you use wait_for_xmitr() instead? If you do that, then you
don't need to move the BOTH_EMPTY macro anymore.
> + serial_out(up, UART_TX, ch);
> +}
> +
> +static int serial_omap_poll_get_char(struct uart_port *port)
> +{
> + struct uart_omap_port *up = (struct uart_omap_port *)port;
> + unsigned int status;
> + int ch;
> +
> + do {
> + status = serial_in(up, UART_LSR);
> + udelay(1);
> + } while ((status & UART_LSR_DR) != UART_LSR_DR);
> +
I think you should be returning NO_POLL_CHAR if the condition is false,
instead of busy looping.
> + ch = (int)serial_in(up, UART_RX);
> + return ch;
> +}
I don't think you need the extra ch variable. Just return serial_in(up,
UART_RX).
Cheers,
Ionut.
next prev parent reply other threads:[~2010-11-21 10:56 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-20 20:51 [PATCH 1/1] serial: omap-serial: Add support for kernel debugger Cosmin Cojocar
2010-11-21 10:56 ` Ionut Nicu [this message]
2010-11-21 13:12 ` Cosmin Cojocar
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=1290336975.26899.16.camel@atlantis.mindbit.ro \
--to=ionut.nicu@mindbit.ro \
--cc=alan@linux.intel.com \
--cc=ben-linux@fluff.org \
--cc=cosmin.cojocar@gmail.com \
--cc=feng.tang@intel.com \
--cc=govindraj.raja@ti.com \
--cc=gregkh@suse.de \
--cc=khilman@deeprootsystems.com \
--cc=linux-omap@vger.kernel.org \
--cc=manjugk@ti.com \
--cc=tklauser@distanz.ch \
/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