All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Add poll_get_char & poll_put_char to uart_ops for the samsung UARTS.
@ 2012-02-12 18:22 Julien Pichon
       [not found] ` <CAHQa92X=9kiVhxCspcAR+dK-NbFqaUW2xTCjjDOAHGfDx_yMBQ@mail.gmail.com>
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Julien Pichon @ 2012-02-12 18:22 UTC (permalink / raw)
  To: linux-samsung-soc

(please CC me in your replies as I am not suscribed to the ML)

The following patch allows users to use KGDB over serial console on
board based on Samsung SOC. It has been tested on a mini2440.

Signed-off-by: Julien Pichon <pichon.jln@gmail.com>
---
 drivers/tty/serial/samsung.c |   50 ++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 50 insertions(+), 0 deletions(-)

diff --git a/drivers/tty/serial/samsung.c b/drivers/tty/serial/samsung.c
index f96f37b..9f703ca 100644
--- a/drivers/tty/serial/samsung.c
+++ b/drivers/tty/serial/samsung.c
@@ -877,11 +877,24 @@ s3c24xx_serial_verify_port(struct uart_port *port, struct serial_struct *ser)
 
 static struct console s3c24xx_serial_console;
 
+static int __init s3c24xx_serial_console_init(void)
+{
+	register_console(&s3c24xx_serial_console);
+	return 0;
+}
+console_initcall(s3c24xx_serial_console_init);
+
 #define S3C24XX_SERIAL_CONSOLE &s3c24xx_serial_console
 #else
 #define S3C24XX_SERIAL_CONSOLE NULL
 #endif
 
+#ifdef CONFIG_CONSOLE_POLL
+static int s3c24xx_serial_get_poll_char(struct uart_port *port);
+static void s3c24xx_serial_put_poll_char(struct uart_port *port,
+			 unsigned char c);
+#endif
+
 static struct uart_ops s3c24xx_serial_ops = {
 	.pm		= s3c24xx_serial_pm,
 	.tx_empty	= s3c24xx_serial_tx_empty,
@@ -900,6 +913,10 @@ static struct uart_ops s3c24xx_serial_ops = {
 	.request_port	= s3c24xx_serial_request_port,
 	.config_port	= s3c24xx_serial_config_port,
 	.verify_port	= s3c24xx_serial_verify_port,
+#ifdef CONFIG_CONSOLE_POLL
+	.poll_get_char = s3c24xx_serial_get_poll_char,
+	.poll_put_char = s3c24xx_serial_put_poll_char,
+#endif
 };
 
 static struct uart_driver s3c24xx_uart_drv = {
@@ -1311,6 +1328,39 @@ s3c24xx_serial_console_txrdy(struct uart_port *port, unsigned int ufcon)
 	return (utrstat & S3C2410_UTRSTAT_TXE) ? 1 : 0;
 }
 
+#ifdef CONFIG_CONSOLE_POLL
+/*
+ * Console polling routines for writing and reading from the uart while
+ * in an interrupt or debug context.
+ */
+
+static int s3c24xx_serial_get_poll_char(struct uart_port *port)
+{
+	struct s3c24xx_uart_port *ourport = to_ourport(port);
+	unsigned int ufstat, count;
+
+	do {
+		ufstat = rd_regl(port, S3C2410_UFSTAT);
+		count = s3c24xx_serial_rx_fifocnt(ourport, ufstat);
+		if (!count)
+			cpu_relax();
+	} while (!count);
+
+	return rd_regb(port, S3C2410_URXH);
+}
+
+static void s3c24xx_serial_put_poll_char(struct uart_port *port,
+		unsigned char c)
+{
+	unsigned int ufcon = rd_regl(cons_uart, S3C2410_UFCON);
+
+	while (!s3c24xx_serial_console_txrdy(port, ufcon))
+		cpu_relax();
+	wr_regb(cons_uart, S3C2410_UTXH, c);
+}
+
+#endif /* CONFIG_CONSOLE_POLL */
+
 static void
 s3c24xx_serial_console_putchar(struct uart_port *port, int ch)
 {
-- 
1.7.2.5

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH] Add poll_get_char & poll_put_char to uart_ops for the samsung UARTS.
       [not found] ` <CAHQa92X=9kiVhxCspcAR+dK-NbFqaUW2xTCjjDOAHGfDx_yMBQ@mail.gmail.com>
@ 2012-02-25 11:05   ` Pichon Julien
  2012-02-25 11:27       ` Heiko Stübner
  0 siblings, 1 reply; 8+ messages in thread
From: Pichon Julien @ 2012-02-25 11:05 UTC (permalink / raw)
  To: linux-samsung-soc; +Cc: ben-linux, kgene.kim

> (please CC me in your replies as I am not suscribed to the ML)
>
> The following patch allows users to use KGDB over serial console on
> board based on Samsung SOC. It has been tested on a mini2440.
>
> Signed-off-by: Julien Pichon <pichon.jln@gmail.com>
> ---
>  drivers/tty/serial/samsung.c |   50 ++++++++++++++++++++++++++++++++++++++++++
>  1 files changed, 50 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/tty/serial/samsung.c b/drivers/tty/serial/samsung.c
> index f96f37b..9f703ca 100644
> --- a/drivers/tty/serial/samsung.c
> +++ b/drivers/tty/serial/samsung.c
> @@ -877,11 +877,24 @@ s3c24xx_serial_verify_port(struct uart_port *port, struct serial_struct *ser)
>
>  static struct console s3c24xx_serial_console;
>
> +static int __init s3c24xx_serial_console_init(void)
> +{
> +     register_console(&s3c24xx_serial_console);
> +     return 0;
> +}
> +console_initcall(s3c24xx_serial_console_init);
> +
>  #define S3C24XX_SERIAL_CONSOLE &s3c24xx_serial_console
>  #else
>  #define S3C24XX_SERIAL_CONSOLE NULL
>  #endif
>
> +#ifdef CONFIG_CONSOLE_POLL
> +static int s3c24xx_serial_get_poll_char(struct uart_port *port);
> +static void s3c24xx_serial_put_poll_char(struct uart_port *port,
> +                      unsigned char c);
> +#endif
> +
>  static struct uart_ops s3c24xx_serial_ops = {
>       .pm             = s3c24xx_serial_pm,
>       .tx_empty       = s3c24xx_serial_tx_empty,
> @@ -900,6 +913,10 @@ static struct uart_ops s3c24xx_serial_ops = {
>       .request_port   = s3c24xx_serial_request_port,
>       .config_port    = s3c24xx_serial_config_port,
>       .verify_port    = s3c24xx_serial_verify_port,
> +#ifdef CONFIG_CONSOLE_POLL
> +     .poll_get_char = s3c24xx_serial_get_poll_char,
> +     .poll_put_char = s3c24xx_serial_put_poll_char,
> +#endif
>  };
>
>  static struct uart_driver s3c24xx_uart_drv = {
> @@ -1311,6 +1328,39 @@ s3c24xx_serial_console_txrdy(struct uart_port *port, unsigned int ufcon)
>       return (utrstat & S3C2410_UTRSTAT_TXE) ? 1 : 0;
>  }
>
> +#ifdef CONFIG_CONSOLE_POLL
> +/*
> + * Console polling routines for writing and reading from the uart while
> + * in an interrupt or debug context.
> + */
> +
> +static int s3c24xx_serial_get_poll_char(struct uart_port *port)
> +{
> +     struct s3c24xx_uart_port *ourport = to_ourport(port);
> +     unsigned int ufstat, count;
> +
> +     do {
> +             ufstat = rd_regl(port, S3C2410_UFSTAT);
> +             count = s3c24xx_serial_rx_fifocnt(ourport, ufstat);
> +             if (!count)
> +                     cpu_relax();
> +     } while (!count);
> +
> +     return rd_regb(port, S3C2410_URXH);
> +}
> +
> +static void s3c24xx_serial_put_poll_char(struct uart_port *port,
> +             unsigned char c)
> +{
> +     unsigned int ufcon = rd_regl(cons_uart, S3C2410_UFCON);
> +
> +     while (!s3c24xx_serial_console_txrdy(port, ufcon))
> +             cpu_relax();
> +     wr_regb(cons_uart, S3C2410_UTXH, c);
> +}
> +
> +#endif /* CONFIG_CONSOLE_POLL */
> +
>  static void
>  s3c24xx_serial_console_putchar(struct uart_port *port, int ch)
>  {
> --
> 1.7.2.5
>
>
(CC maintainers)
Someone has time to review this patch ?

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] Add poll_get_char & poll_put_char to uart_ops for the samsung UARTS.
  2012-02-25 11:05   ` Pichon Julien
@ 2012-02-25 11:27       ` Heiko Stübner
  0 siblings, 0 replies; 8+ messages in thread
From: Heiko Stübner @ 2012-02-25 11:27 UTC (permalink / raw)
  To: Pichon Julien; +Cc: kgene.kim, linux-samsung-soc, linux-arm-kernel, ben-linux

Am Samstag 25 Februar 2012, 12:05:56 schrieb Pichon Julien:
> > (please CC me in your replies as I am not suscribed to the ML)
> > 
> > The following patch allows users to use KGDB over serial console on
> > board based on Samsung SOC. It has been tested on a mini2440.
> > 
> > Signed-off-by: Julien Pichon <pichon.jln@gmail.com>
> > ---
> >  drivers/tty/serial/samsung.c |   50
> > ++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 50
> > insertions(+), 0 deletions(-)
> > 
> > diff --git a/drivers/tty/serial/samsung.c b/drivers/tty/serial/samsung.c
> > index f96f37b..9f703ca 100644
> > --- a/drivers/tty/serial/samsung.c
> > +++ b/drivers/tty/serial/samsung.c
> > @@ -877,11 +877,24 @@ s3c24xx_serial_verify_port(struct uart_port *port,
> > struct serial_struct *ser)
> > 
> >  static struct console s3c24xx_serial_console;
> > 
> > +static int __init s3c24xx_serial_console_init(void)
> > +{
> > +     register_console(&s3c24xx_serial_console);
> > +     return 0;
> > +}
> > +console_initcall(s3c24xx_serial_console_init);
> > +
> >  #define S3C24XX_SERIAL_CONSOLE &s3c24xx_serial_console
> >  #else
> >  #define S3C24XX_SERIAL_CONSOLE NULL
> >  #endif
> > 
> > +#ifdef CONFIG_CONSOLE_POLL
> > +static int s3c24xx_serial_get_poll_char(struct uart_port *port);
> > +static void s3c24xx_serial_put_poll_char(struct uart_port *port,
> > +                      unsigned char c);
> > +#endif
> > +
> >  static struct uart_ops s3c24xx_serial_ops = {
> >       .pm             = s3c24xx_serial_pm,
> >       .tx_empty       = s3c24xx_serial_tx_empty,
> > @@ -900,6 +913,10 @@ static struct uart_ops s3c24xx_serial_ops = {
> >       .request_port   = s3c24xx_serial_request_port,
> >       .config_port    = s3c24xx_serial_config_port,
> >       .verify_port    = s3c24xx_serial_verify_port,
> > +#ifdef CONFIG_CONSOLE_POLL
> > +     .poll_get_char = s3c24xx_serial_get_poll_char,
> > +     .poll_put_char = s3c24xx_serial_put_poll_char,
> > +#endif
> >  };
> > 
> >  static struct uart_driver s3c24xx_uart_drv = {
> > @@ -1311,6 +1328,39 @@ s3c24xx_serial_console_txrdy(struct uart_port
> > *port, unsigned int ufcon) return (utrstat & S3C2410_UTRSTAT_TXE) ? 1 :
> > 0;
> >  }
> > 
> > +#ifdef CONFIG_CONSOLE_POLL
> > +/*
> > + * Console polling routines for writing and reading from the uart while
> > + * in an interrupt or debug context.
> > + */
> > +
> > +static int s3c24xx_serial_get_poll_char(struct uart_port *port)
> > +{
> > +     struct s3c24xx_uart_port *ourport = to_ourport(port);
> > +     unsigned int ufstat, count;
> > +
> > +     do {
> > +             ufstat = rd_regl(port, S3C2410_UFSTAT);
> > +             count = s3c24xx_serial_rx_fifocnt(ourport, ufstat);
> > +             if (!count)
> > +                     cpu_relax();
> > +     } while (!count);
> > +
> > +     return rd_regb(port, S3C2410_URXH);
> > +}
> > +
> > +static void s3c24xx_serial_put_poll_char(struct uart_port *port,
> > +             unsigned char c)
> > +{
> > +     unsigned int ufcon = rd_regl(cons_uart, S3C2410_UFCON);
> > +
> > +     while (!s3c24xx_serial_console_txrdy(port, ufcon))
> > +             cpu_relax();
> > +     wr_regb(cons_uart, S3C2410_UTXH, c);
> > +}
> > +
> > +#endif /* CONFIG_CONSOLE_POLL */
> > +
> >  static void
> >  s3c24xx_serial_console_putchar(struct uart_port *port, int ch)
> >  {
> > --
> > 1.7.2.5
> 
> (CC maintainers)
> Someone has time to review this patch ?

It might be goot to included the linux-arm-kernel list to get a wider 
audience. I always felt, that the samsung ml isn't read by many.

Heiko

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH] Add poll_get_char & poll_put_char to uart_ops for the samsung UARTS.
@ 2012-02-25 11:27       ` Heiko Stübner
  0 siblings, 0 replies; 8+ messages in thread
From: Heiko Stübner @ 2012-02-25 11:27 UTC (permalink / raw)
  To: linux-arm-kernel

Am Samstag 25 Februar 2012, 12:05:56 schrieb Pichon Julien:
> > (please CC me in your replies as I am not suscribed to the ML)
> > 
> > The following patch allows users to use KGDB over serial console on
> > board based on Samsung SOC. It has been tested on a mini2440.
> > 
> > Signed-off-by: Julien Pichon <pichon.jln@gmail.com>
> > ---
> >  drivers/tty/serial/samsung.c |   50
> > ++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 50
> > insertions(+), 0 deletions(-)
> > 
> > diff --git a/drivers/tty/serial/samsung.c b/drivers/tty/serial/samsung.c
> > index f96f37b..9f703ca 100644
> > --- a/drivers/tty/serial/samsung.c
> > +++ b/drivers/tty/serial/samsung.c
> > @@ -877,11 +877,24 @@ s3c24xx_serial_verify_port(struct uart_port *port,
> > struct serial_struct *ser)
> > 
> >  static struct console s3c24xx_serial_console;
> > 
> > +static int __init s3c24xx_serial_console_init(void)
> > +{
> > +     register_console(&s3c24xx_serial_console);
> > +     return 0;
> > +}
> > +console_initcall(s3c24xx_serial_console_init);
> > +
> >  #define S3C24XX_SERIAL_CONSOLE &s3c24xx_serial_console
> >  #else
> >  #define S3C24XX_SERIAL_CONSOLE NULL
> >  #endif
> > 
> > +#ifdef CONFIG_CONSOLE_POLL
> > +static int s3c24xx_serial_get_poll_char(struct uart_port *port);
> > +static void s3c24xx_serial_put_poll_char(struct uart_port *port,
> > +                      unsigned char c);
> > +#endif
> > +
> >  static struct uart_ops s3c24xx_serial_ops = {
> >       .pm             = s3c24xx_serial_pm,
> >       .tx_empty       = s3c24xx_serial_tx_empty,
> > @@ -900,6 +913,10 @@ static struct uart_ops s3c24xx_serial_ops = {
> >       .request_port   = s3c24xx_serial_request_port,
> >       .config_port    = s3c24xx_serial_config_port,
> >       .verify_port    = s3c24xx_serial_verify_port,
> > +#ifdef CONFIG_CONSOLE_POLL
> > +     .poll_get_char = s3c24xx_serial_get_poll_char,
> > +     .poll_put_char = s3c24xx_serial_put_poll_char,
> > +#endif
> >  };
> > 
> >  static struct uart_driver s3c24xx_uart_drv = {
> > @@ -1311,6 +1328,39 @@ s3c24xx_serial_console_txrdy(struct uart_port
> > *port, unsigned int ufcon) return (utrstat & S3C2410_UTRSTAT_TXE) ? 1 :
> > 0;
> >  }
> > 
> > +#ifdef CONFIG_CONSOLE_POLL
> > +/*
> > + * Console polling routines for writing and reading from the uart while
> > + * in an interrupt or debug context.
> > + */
> > +
> > +static int s3c24xx_serial_get_poll_char(struct uart_port *port)
> > +{
> > +     struct s3c24xx_uart_port *ourport = to_ourport(port);
> > +     unsigned int ufstat, count;
> > +
> > +     do {
> > +             ufstat = rd_regl(port, S3C2410_UFSTAT);
> > +             count = s3c24xx_serial_rx_fifocnt(ourport, ufstat);
> > +             if (!count)
> > +                     cpu_relax();
> > +     } while (!count);
> > +
> > +     return rd_regb(port, S3C2410_URXH);
> > +}
> > +
> > +static void s3c24xx_serial_put_poll_char(struct uart_port *port,
> > +             unsigned char c)
> > +{
> > +     unsigned int ufcon = rd_regl(cons_uart, S3C2410_UFCON);
> > +
> > +     while (!s3c24xx_serial_console_txrdy(port, ufcon))
> > +             cpu_relax();
> > +     wr_regb(cons_uart, S3C2410_UTXH, c);
> > +}
> > +
> > +#endif /* CONFIG_CONSOLE_POLL */
> > +
> >  static void
> >  s3c24xx_serial_console_putchar(struct uart_port *port, int ch)
> >  {
> > --
> > 1.7.2.5
> 
> (CC maintainers)
> Someone has time to review this patch ?

It might be goot to included the linux-arm-kernel list to get a wider 
audience. I always felt, that the samsung ml isn't read by many.

Heiko

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] Add poll_get_char & poll_put_char to uart_ops for the samsung UARTS.
  2012-02-12 18:22 [PATCH] Add poll_get_char & poll_put_char to uart_ops for the samsung UARTS Julien Pichon
       [not found] ` <CAHQa92X=9kiVhxCspcAR+dK-NbFqaUW2xTCjjDOAHGfDx_yMBQ@mail.gmail.com>
@ 2012-02-26 18:31 ` Denis 'GNUtoo' Carikli
  2012-09-22  6:22 ` [PATCH] serial: samsung: Add poll_get_char & poll_put_char Doug Anderson
  2 siblings, 0 replies; 8+ messages in thread
From: Denis 'GNUtoo' Carikli @ 2012-02-26 18:31 UTC (permalink / raw)
  To: Julien Pichon; +Cc: linux-samsung-soc

Hi Julien,

>The following patch allows users to use KGDB over serial console on
>board based on Samsung SOC. It has been tested on a mini2440.
(gdb) target remote /dev/ttyUSB0
Remote debugging using /dev/ttyUSB0
kgdb_breakpoint () at kernel/debug/debug_core.c:959
959		arch_kgdb_breakpoint();

It works on a gta02 machine too...

Thanks a lot for working on that, it will help me a lot for continuing to fix 
things in mainline for gta02, It already was very usefull with debugging an 
alsa problem.

Tested-by: Denis 'GNUtoo' Carikli <GNUtoo@no-log.org>

Denis.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] Add poll_get_char & poll_put_char to uart_ops for the samsung UARTS.
  2012-02-25 11:27       ` Heiko Stübner
@ 2012-02-26 18:34         ` Denis 'GNUtoo' Carikli
  -1 siblings, 0 replies; 8+ messages in thread
From: Denis 'GNUtoo' Carikli @ 2012-02-26 18:34 UTC (permalink / raw)
  To: Heiko Stübner
  Cc: Pichon Julien, linux-samsung-soc, ben-linux, kgene.kim, linux-arm-kernel

>It might be goot to included the linux-arm-kernel list to get a wider 
>audience. I always felt, that the samsung ml isn't read by many.
Why not the linux-serial mailing list?
I sent a patch there and it was accepted in Greg Kroah-Hartman's tree really 
fast(it didn't hit linux-next yet tough).

Denis.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH] Add poll_get_char & poll_put_char to uart_ops for the samsung UARTS.
@ 2012-02-26 18:34         ` Denis 'GNUtoo' Carikli
  0 siblings, 0 replies; 8+ messages in thread
From: Denis 'GNUtoo' Carikli @ 2012-02-26 18:34 UTC (permalink / raw)
  To: linux-arm-kernel

>It might be goot to included the linux-arm-kernel list to get a wider 
>audience. I always felt, that the samsung ml isn't read by many.
Why not the linux-serial mailing list?
I sent a patch there and it was accepted in Greg Kroah-Hartman's tree really 
fast(it didn't hit linux-next yet tough).

Denis.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH] serial: samsung: Add poll_get_char & poll_put_char
  2012-02-12 18:22 [PATCH] Add poll_get_char & poll_put_char to uart_ops for the samsung UARTS Julien Pichon
       [not found] ` <CAHQa92X=9kiVhxCspcAR+dK-NbFqaUW2xTCjjDOAHGfDx_yMBQ@mail.gmail.com>
  2012-02-26 18:31 ` Denis 'GNUtoo' Carikli
@ 2012-09-22  6:22 ` Doug Anderson
  2 siblings, 0 replies; 8+ messages in thread
From: Doug Anderson @ 2012-09-22  6:22 UTC (permalink / raw)
  To: linux-samsung-soc
  Cc: linux-serial, linux-kernel, Julien Pichon, Alan Cox,
	Greg Kroah-Hartman, kgene.kim, GNUtoo, heiko, ben-linux,
	Doug Anderson

From: Julien Pichon <pichon.jln@gmail.com>

The following patch allows users to use KGDB over serial console on
board based on Samsung SOC. It has been tested on a board using
exynos5.

Signed-off-by: Julien Pichon <pichon.jln@gmail.com>
Signed-off-by: Doug Anderson <dianders@chromium.org>
(dianders changed poll to return NO_POLL_CHAR, which appears to
fix 'help' in kgdb; also updated commit message)
---
This is pulled from an email on <linux-samsung-soc@vger.kernel.org>
from Feb 18, 2012. It's never landed anywhere. I've made a small modification
that make it so that kgdb's "help" doesn't crash.

See: http://comments.gmane.org/gmane.linux.kernel.samsung-soc/9477

 drivers/tty/serial/samsung.c |   47 ++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 47 insertions(+), 0 deletions(-)

diff --git a/drivers/tty/serial/samsung.c b/drivers/tty/serial/samsung.c
index 8eef114..7f04717 100644
--- a/drivers/tty/serial/samsung.c
+++ b/drivers/tty/serial/samsung.c
@@ -876,11 +876,24 @@ s3c24xx_serial_verify_port(struct uart_port *port, struct serial_struct *ser)
 
 static struct console s3c24xx_serial_console;
 
+static int __init s3c24xx_serial_console_init(void)
+{
+	register_console(&s3c24xx_serial_console);
+	return 0;
+}
+console_initcall(s3c24xx_serial_console_init);
+
 #define S3C24XX_SERIAL_CONSOLE &s3c24xx_serial_console
 #else
 #define S3C24XX_SERIAL_CONSOLE NULL
 #endif
 
+#ifdef CONFIG_CONSOLE_POLL
+static int s3c24xx_serial_get_poll_char(struct uart_port *port);
+static void s3c24xx_serial_put_poll_char(struct uart_port *port,
+			 unsigned char c);
+#endif
+
 static struct uart_ops s3c24xx_serial_ops = {
 	.pm		= s3c24xx_serial_pm,
 	.tx_empty	= s3c24xx_serial_tx_empty,
@@ -899,6 +912,10 @@ static struct uart_ops s3c24xx_serial_ops = {
 	.request_port	= s3c24xx_serial_request_port,
 	.config_port	= s3c24xx_serial_config_port,
 	.verify_port	= s3c24xx_serial_verify_port,
+#ifdef CONFIG_CONSOLE_POLL
+	.poll_get_char = s3c24xx_serial_get_poll_char,
+	.poll_put_char = s3c24xx_serial_put_poll_char,
+#endif
 };
 
 static struct uart_driver s3c24xx_uart_drv = {
@@ -1316,6 +1333,36 @@ s3c24xx_serial_console_txrdy(struct uart_port *port, unsigned int ufcon)
 	return (utrstat & S3C2410_UTRSTAT_TXE) ? 1 : 0;
 }
 
+#ifdef CONFIG_CONSOLE_POLL
+/*
+ * Console polling routines for writing and reading from the uart while
+ * in an interrupt or debug context.
+ */
+
+static int s3c24xx_serial_get_poll_char(struct uart_port *port)
+{
+	struct s3c24xx_uart_port *ourport = to_ourport(port);
+	unsigned int ufstat;
+
+	ufstat = rd_regl(port, S3C2410_UFSTAT);
+	if (s3c24xx_serial_rx_fifocnt(ourport, ufstat) == 0)
+		return NO_POLL_CHAR;
+
+	return rd_regb(port, S3C2410_URXH);
+}
+
+static void s3c24xx_serial_put_poll_char(struct uart_port *port,
+		unsigned char c)
+{
+	unsigned int ufcon = rd_regl(cons_uart, S3C2410_UFCON);
+
+	while (!s3c24xx_serial_console_txrdy(port, ufcon))
+		cpu_relax();
+	wr_regb(cons_uart, S3C2410_UTXH, c);
+}
+
+#endif /* CONFIG_CONSOLE_POLL */
+
 static void
 s3c24xx_serial_console_putchar(struct uart_port *port, int ch)
 {
-- 
1.7.7.3


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2012-09-22  6:23 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-02-12 18:22 [PATCH] Add poll_get_char & poll_put_char to uart_ops for the samsung UARTS Julien Pichon
     [not found] ` <CAHQa92X=9kiVhxCspcAR+dK-NbFqaUW2xTCjjDOAHGfDx_yMBQ@mail.gmail.com>
2012-02-25 11:05   ` Pichon Julien
2012-02-25 11:27     ` Heiko Stübner
2012-02-25 11:27       ` Heiko Stübner
2012-02-26 18:34       ` Denis 'GNUtoo' Carikli
2012-02-26 18:34         ` Denis 'GNUtoo' Carikli
2012-02-26 18:31 ` Denis 'GNUtoo' Carikli
2012-09-22  6:22 ` [PATCH] serial: samsung: Add poll_get_char & poll_put_char Doug Anderson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.