* [PATCH] Add poll_get_char and poll_put_char uart_ops to atmel_serial.
@ 2009-06-30 9:05 Albin Tonnerre
2009-07-27 14:23 ` Haavard Skinnemoen
0 siblings, 1 reply; 13+ messages in thread
From: Albin Tonnerre @ 2009-06-30 9:05 UTC (permalink / raw)
To: hskinnemoen; +Cc: linux-kernel, Albin Tonnerre
[Please CC: me on replies, I'm not subscribed]
This patch allows using KGDB over the console with the atmel_serial
driver.
Signed-off-by: Albin Tonnerre <albin.tonnerre@free-electrons.com>
---
drivers/serial/atmel_serial.c | 27 +++++++++++++++++++++++++++
1 files changed, 27 insertions(+), 0 deletions(-)
diff --git a/drivers/serial/atmel_serial.c b/drivers/serial/atmel_serial.c
index b3497d7..aaab321 100644
--- a/drivers/serial/atmel_serial.c
+++ b/drivers/serial/atmel_serial.c
@@ -1211,6 +1211,29 @@ static int atmel_verify_port(struct uart_port *port, struct serial_struct *ser)
return ret;
}
+#ifdef CONFIG_CONSOLE_POLL
+static int atmel_poll_get_char(struct uart_port *port)
+{
+ struct atmel_uart_port *aup = to_atmel_uart_port(port);
+
+ while (!(readb(aup->uart.membase + ATMEL_US_CSR) & ATMEL_US_RXRDY))
+ barrier();
+
+ return readb(aup->uart.membase + ATMEL_US_RHR);
+}
+
+static void atmel_poll_put_char(struct uart_port *port, unsigned char ch)
+{
+ struct atmel_uart_port *aup = to_atmel_uart_port(port);
+ unsigned int status;
+
+ while (!(readb(aup->uart.membase + ATMEL_US_CSR) & ATMEL_US_TXRDY))
+ barrier();
+
+ writeb(ch, aup->uart.membase + ATMEL_US_THR);
+}
+#endif
+
static struct uart_ops atmel_pops = {
.tx_empty = atmel_tx_empty,
.set_mctrl = atmel_set_mctrl,
@@ -1230,6 +1253,10 @@ static struct uart_ops atmel_pops = {
.config_port = atmel_config_port,
.verify_port = atmel_verify_port,
.pm = atmel_serial_pm,
+#ifdef CONFIG_CONSOLE_POLL
+ .poll_get_char = atmel_poll_get_char,
+ .poll_put_char = atmel_poll_put_char,
+#endif
};
/*
--
1.6.0.4
^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH] Add poll_get_char and poll_put_char uart_ops to atmel_serial.
2009-06-30 9:05 [PATCH] Add poll_get_char and poll_put_char uart_ops to atmel_serial Albin Tonnerre
@ 2009-07-27 14:23 ` Haavard Skinnemoen
2009-07-27 15:19 ` Albin Tonnerre
0 siblings, 1 reply; 13+ messages in thread
From: Haavard Skinnemoen @ 2009-07-27 14:23 UTC (permalink / raw)
To: Albin Tonnerre; +Cc: avictor.za, linux-kernel, Albin Tonnerre, Nicolas Ferre
[added AT91 maintainers to Cc]
Albin Tonnerre wrote:
> +#ifdef CONFIG_CONSOLE_POLL
> +static int atmel_poll_get_char(struct uart_port *port)
> +{
> + struct atmel_uart_port *aup = to_atmel_uart_port(port);
> +
> + while (!(readb(aup->uart.membase + ATMEL_US_CSR) & ATMEL_US_RXRDY))
> + barrier();
> +
> + return readb(aup->uart.membase + ATMEL_US_RHR);
> +}
> +
> +static void atmel_poll_put_char(struct uart_port *port, unsigned char ch)
> +{
> + struct atmel_uart_port *aup = to_atmel_uart_port(port);
> + unsigned int status;
> +
> + while (!(readb(aup->uart.membase + ATMEL_US_CSR) & ATMEL_US_TXRDY))
> + barrier();
> +
> + writeb(ch, aup->uart.membase + ATMEL_US_THR);
> +}
> +#endif
All the registers are 32 bits wide, so you should use __raw_readl() and
__raw_writel() to avoid any endianness issues (AT91 is little endian
and AVR32 is big endian).
Haavard
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] Add poll_get_char and poll_put_char uart_ops to atmel_serial.
2009-07-27 14:23 ` Haavard Skinnemoen
@ 2009-07-27 15:19 ` Albin Tonnerre
2009-07-28 16:09 ` Haavard Skinnemoen
2009-09-07 6:22 ` Andrew Victor
0 siblings, 2 replies; 13+ messages in thread
From: Albin Tonnerre @ 2009-07-27 15:19 UTC (permalink / raw)
To: Haavard Skinnemoen; +Cc: avictor.za, linux-kernel, Nicolas Ferre
This patch allows using KGDB over the console with the atmel_serial
driver.
Signed-off-by: Albin Tonnerre <albin.tonnerre@free-electrons.com>
---
Updated patch to use __raw_readl/__raw_writel, as per Haavard's comments.
drivers/serial/atmel_serial.c | 26 ++++++++++++++++++++++++++
1 files changed, 26 insertions(+), 0 deletions(-)
diff --git a/drivers/serial/atmel_serial.c b/drivers/serial/atmel_serial.c
index 338b15c..1e65046 100644
--- a/drivers/serial/atmel_serial.c
+++ b/drivers/serial/atmel_serial.c
@@ -1213,6 +1213,28 @@ static int atmel_verify_port(struct uart_port *port, struct serial_struct *ser)
return ret;
}
+#ifdef CONFIG_CONSOLE_POLL
+static int atmel_poll_get_char(struct uart_port *port)
+{
+ struct atmel_uart_port *aup = to_atmel_uart_port(port);
+
+ while (!(__raw_readl(aup->uart.membase + ATMEL_US_CSR) & ATMEL_US_RXRDY))
+ barrier();
+
+ return __raw_readl(aup->uart.membase + ATMEL_US_RHR);
+}
+
+static void atmel_poll_put_char(struct uart_port *port, unsigned char ch)
+{
+ struct atmel_uart_port *aup = to_atmel_uart_port(port);
+
+ while (!(__raw_readl(aup->uart.membase + ATMEL_US_CSR) & ATMEL_US_TXRDY))
+ barrier();
+
+ __raw_writel(ch, aup->uart.membase + ATMEL_US_THR);
+}
+#endif
+
static struct uart_ops atmel_pops = {
.tx_empty = atmel_tx_empty,
.set_mctrl = atmel_set_mctrl,
@@ -1232,6 +1254,10 @@ static struct uart_ops atmel_pops = {
.config_port = atmel_config_port,
.verify_port = atmel_verify_port,
.pm = atmel_serial_pm,
+#ifdef CONFIG_CONSOLE_POLL
+ .poll_get_char = atmel_poll_get_char,
+ .poll_put_char = atmel_poll_put_char,
+#endif
};
/*
--
Albin Tonnerre, Free Electrons
Kernel, drivers and embedded Linux development,
consulting, training and support.
http://free-electrons.com
^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH] Add poll_get_char and poll_put_char uart_ops to atmel_serial.
2009-07-27 15:19 ` Albin Tonnerre
@ 2009-07-28 16:09 ` Haavard Skinnemoen
2009-09-04 15:34 ` Albin Tonnerre
2009-09-07 6:22 ` Andrew Victor
1 sibling, 1 reply; 13+ messages in thread
From: Haavard Skinnemoen @ 2009-07-28 16:09 UTC (permalink / raw)
To: Albin Tonnerre; +Cc: avictor.za, linux-kernel, Nicolas Ferre
Albin Tonnerre wrote:
> This patch allows using KGDB over the console with the atmel_serial
> driver.
>
> Signed-off-by: Albin Tonnerre <albin.tonnerre@free-electrons.com>
Acked-by: Haavard Skinnemoen <haavard.skinnemoen@atmel.com>
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] Add poll_get_char and poll_put_char uart_ops to atmel_serial.
2009-07-28 16:09 ` Haavard Skinnemoen
@ 2009-09-04 15:34 ` Albin Tonnerre
0 siblings, 0 replies; 13+ messages in thread
From: Albin Tonnerre @ 2009-09-04 15:34 UTC (permalink / raw)
To: avictor.za, linux-kernel, Nicolas Ferre; +Cc: Haavard Skinnemoen
On Tue, Jul 28, 2009 at 06:09:41PM +0200, Haavard Skinnemoen wrote :
> Albin Tonnerre wrote:
> > This patch allows using KGDB over the console with the atmel_serial
> > driver.
> >
> > Signed-off-by: Albin Tonnerre <albin.tonnerre@free-electrons.com>
>
> Acked-by: Haavard Skinnemoen <haavard.skinnemoen@atmel.com>
Nicolas, Andrew: Any news on this?
Regards,
--
Albin Tonnerre, Free Electrons
Kernel, drivers and embedded Linux development,
consulting, training and support.
http://free-electrons.com
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] Add poll_get_char and poll_put_char uart_ops to atmel_serial.
2009-07-27 15:19 ` Albin Tonnerre
2009-07-28 16:09 ` Haavard Skinnemoen
@ 2009-09-07 6:22 ` Andrew Victor
2009-09-07 9:52 ` [PATCH v2] " Albin Tonnerre
1 sibling, 1 reply; 13+ messages in thread
From: Andrew Victor @ 2009-09-07 6:22 UTC (permalink / raw)
To: Albin Tonnerre; +Cc: Haavard Skinnemoen, linux-kernel, Nicolas Ferre
hi Albin,
Any reason you're not using the register access macro's like the rest
of the driver?
> + while (!(__raw_readl(aup->uart.membase + ATMEL_US_CSR) & ATMEL_US_RXRDY))
while (!(UART_GET_CSR(..) & ATMEL_US_RXRDY))
> + return __raw_readl(aup->uart.membase + ATMEL_US_RHR);
return UART_GET_CHAR(..);
> + __raw_writel(ch, aup->uart.membase + ATMEL_US_THR);
UART_PUT_CHAR(..., ch);
Otherwise the patch looks fine to me.
Regards,
Andrew Victor
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH v2] Add poll_get_char and poll_put_char uart_ops to atmel_serial.
2009-09-07 6:22 ` Andrew Victor
@ 2009-09-07 9:52 ` Albin Tonnerre
2009-09-07 18:17 ` Andrew Victor
` (3 more replies)
0 siblings, 4 replies; 13+ messages in thread
From: Albin Tonnerre @ 2009-09-07 9:52 UTC (permalink / raw)
To: avictor.za
Cc: linux-kernel, haavard.skinnemoen, nicolas.ferre, Albin Tonnerre
This patch allows using KGDB over the console with the atmel_serial
driver.
Signed-off-by: Albin Tonnerre <albin.tonnerre@free-electrons.com>
---
changes: Use register access macros instead of __raw_readl/writel
drivers/serial/atmel_serial.c | 22 ++++++++++++++++++++++
1 files changed, 22 insertions(+), 0 deletions(-)
diff --git a/drivers/serial/atmel_serial.c b/drivers/serial/atmel_serial.c
index 607d43a..c562883 100644
--- a/drivers/serial/atmel_serial.c
+++ b/drivers/serial/atmel_serial.c
@@ -1213,6 +1213,24 @@ static int atmel_verify_port(struct uart_port *port, struct serial_struct *ser)
return ret;
}
+#ifdef CONFIG_CONSOLE_POLL
+static int atmel_poll_get_char(struct uart_port *port)
+{
+ while (!(UART_GET_CSR(port) & ATMEL_US_RXRDY))
+ barrier();
+
+ return UART_GET_CHAR(port);
+}
+
+static void atmel_poll_put_char(struct uart_port *port, unsigned char ch)
+{
+ while (!(UART_GET_CSR(port) & ATMEL_US_TXRDY))
+ barrier();
+
+ UART_PUT_CHAR(port, ch);
+}
+#endif
+
static struct uart_ops atmel_pops = {
.tx_empty = atmel_tx_empty,
.set_mctrl = atmel_set_mctrl,
@@ -1232,6 +1250,10 @@ static struct uart_ops atmel_pops = {
.config_port = atmel_config_port,
.verify_port = atmel_verify_port,
.pm = atmel_serial_pm,
+#ifdef CONFIG_CONSOLE_POLL
+ .poll_get_char = atmel_poll_get_char,
+ .poll_put_char = atmel_poll_put_char,
+#endif
};
/*
--
1.6.3.3
^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH v2] Add poll_get_char and poll_put_char uart_ops to atmel_serial.
2009-09-07 9:52 ` [PATCH v2] " Albin Tonnerre
@ 2009-09-07 18:17 ` Andrew Victor
2009-09-08 8:30 ` Haavard Skinnemoen
` (2 subsequent siblings)
3 siblings, 0 replies; 13+ messages in thread
From: Andrew Victor @ 2009-09-07 18:17 UTC (permalink / raw)
To: Albin Tonnerre; +Cc: linux-kernel, haavard.skinnemoen, nicolas.ferre
hi Albin,
> This patch allows using KGDB over the console with the atmel_serial
> driver.
>
> Signed-off-by: Albin Tonnerre <albin.tonnerre@free-electrons.com>
Acked-by: Andrew Victor <linux@maxim.org.za>
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v2] Add poll_get_char and poll_put_char uart_ops to atmel_serial.
2009-09-07 9:52 ` [PATCH v2] " Albin Tonnerre
2009-09-07 18:17 ` Andrew Victor
@ 2009-09-08 8:30 ` Haavard Skinnemoen
2009-09-11 11:31 ` Albin Tonnerre
2009-11-11 11:37 ` Albin Tonnerre
2009-11-12 22:24 ` Andrew Morton
3 siblings, 1 reply; 13+ messages in thread
From: Haavard Skinnemoen @ 2009-09-08 8:30 UTC (permalink / raw)
To: Albin Tonnerre; +Cc: avictor.za, linux-kernel, nicolas.ferre, Albin Tonnerre
Albin Tonnerre <albin.tonnerre@free-electrons.com> wrote:
> This patch allows using KGDB over the console with the atmel_serial
> driver.
>
> Signed-off-by: Albin Tonnerre <albin.tonnerre@free-electrons.com>
Acked-by: Haavard Skinnemoen <haavard.skinnemoen@atmel.com>
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v2] Add poll_get_char and poll_put_char uart_ops to atmel_serial.
2009-09-08 8:30 ` Haavard Skinnemoen
@ 2009-09-11 11:31 ` Albin Tonnerre
2009-10-10 18:57 ` Albin Tonnerre
0 siblings, 1 reply; 13+ messages in thread
From: Albin Tonnerre @ 2009-09-11 11:31 UTC (permalink / raw)
To: Haavard Skinnemoen; +Cc: avictor.za, linux-kernel, nicolas.ferre
On Tue, 08 Sep 2009 10:30 +0200, Haavard Skinnemoen wrote :
> Albin Tonnerre <albin.tonnerre@free-electrons.com> wrote:
> > This patch allows using KGDB over the console with the atmel_serial
> > driver.
> >
> > Signed-off-by: Albin Tonnerre <albin.tonnerre@free-electrons.com>
>
> Acked-by: Haavard Skinnemoen <haavard.skinnemoen@atmel.com>
Thanks Haavard & Andrew for your Acked-by. Is there anything I need to do to get
this pushed to mainline?
Regards,
--
Albin Tonnerre, Free Electrons
Kernel, drivers and embedded Linux development,
consulting, training and support.
http://free-electrons.com
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v2] Add poll_get_char and poll_put_char uart_ops to atmel_serial.
2009-09-11 11:31 ` Albin Tonnerre
@ 2009-10-10 18:57 ` Albin Tonnerre
0 siblings, 0 replies; 13+ messages in thread
From: Albin Tonnerre @ 2009-10-10 18:57 UTC (permalink / raw)
To: Haavard Skinnemoen; +Cc: avictor.za, linux-kernel, nicolas.ferre
On Fri, 11 Sep 2009 13:31 +0200, Albin Tonnerre wrote :
> On Tue, 08 Sep 2009 10:30 +0200, Haavard Skinnemoen wrote :
> > Albin Tonnerre <albin.tonnerre@free-electrons.com> wrote:
> > > This patch allows using KGDB over the console with the atmel_serial
> > > driver.
> > > Signed-off-by: Albin Tonnerre <albin.tonnerre@free-electrons.com>
> > Acked-by: Haavard Skinnemoen <haavard.skinnemoen@atmel.com>
> Thanks Haavard & Andrew for your Acked-by. Is there anything I need to do to get
> this pushed to mainline?
Ping?
Cheers,
--
Albin Tonnerre, Free Electrons
Kernel, drivers and embedded Linux development,
consulting, training and support.
http://free-electrons.com
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v2] Add poll_get_char and poll_put_char uart_ops to atmel_serial.
2009-09-07 9:52 ` [PATCH v2] " Albin Tonnerre
2009-09-07 18:17 ` Andrew Victor
2009-09-08 8:30 ` Haavard Skinnemoen
@ 2009-11-11 11:37 ` Albin Tonnerre
2009-11-12 22:24 ` Andrew Morton
3 siblings, 0 replies; 13+ messages in thread
From: Albin Tonnerre @ 2009-11-11 11:37 UTC (permalink / raw)
To: akpm; +Cc: linux-kernel, haavard.skinnemoen, avictor.za
Andrew, could you please pick this up ? It got:
Acked-by: Haavard Skinnemoen <haavard.skinnemoen@atmel.com>
Acked-by: Andrew Victor <linux@maxim.org.za>
Regards,
Albin
On Mon, 07 Sep 2009 11:52 +0200, Albin Tonnerre wrote :
> This patch allows using KGDB over the console with the atmel_serial
> driver.
>
> Signed-off-by: Albin Tonnerre <albin.tonnerre@free-electrons.com>
> ---
> changes: Use register access macros instead of __raw_readl/writel
>
> drivers/serial/atmel_serial.c | 22 ++++++++++++++++++++++
> 1 files changed, 22 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/serial/atmel_serial.c b/drivers/serial/atmel_serial.c
> index 607d43a..c562883 100644
> --- a/drivers/serial/atmel_serial.c
> +++ b/drivers/serial/atmel_serial.c
> @@ -1213,6 +1213,24 @@ static int atmel_verify_port(struct uart_port *port, struct serial_struct *ser)
> return ret;
> }
>
> +#ifdef CONFIG_CONSOLE_POLL
> +static int atmel_poll_get_char(struct uart_port *port)
> +{
> + while (!(UART_GET_CSR(port) & ATMEL_US_RXRDY))
> + barrier();
> +
> + return UART_GET_CHAR(port);
> +}
> +
> +static void atmel_poll_put_char(struct uart_port *port, unsigned char ch)
> +{
> + while (!(UART_GET_CSR(port) & ATMEL_US_TXRDY))
> + barrier();
> +
> + UART_PUT_CHAR(port, ch);
> +}
> +#endif
> +
> static struct uart_ops atmel_pops = {
> .tx_empty = atmel_tx_empty,
> .set_mctrl = atmel_set_mctrl,
> @@ -1232,6 +1250,10 @@ static struct uart_ops atmel_pops = {
> .config_port = atmel_config_port,
> .verify_port = atmel_verify_port,
> .pm = atmel_serial_pm,
> +#ifdef CONFIG_CONSOLE_POLL
> + .poll_get_char = atmel_poll_get_char,
> + .poll_put_char = atmel_poll_put_char,
> +#endif
> };
>
> /*
--
Albin Tonnerre, Free Electrons
Kernel, drivers and embedded Linux development,
consulting, training and support.
http://free-electrons.com
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v2] Add poll_get_char and poll_put_char uart_ops to atmel_serial.
2009-09-07 9:52 ` [PATCH v2] " Albin Tonnerre
` (2 preceding siblings ...)
2009-11-11 11:37 ` Albin Tonnerre
@ 2009-11-12 22:24 ` Andrew Morton
3 siblings, 0 replies; 13+ messages in thread
From: Andrew Morton @ 2009-11-12 22:24 UTC (permalink / raw)
To: Albin Tonnerre
Cc: avictor.za, linux-kernel, haavard.skinnemoen, nicolas.ferre
On Mon, 7 Sep 2009 11:52:50 +0200
Albin Tonnerre <albin.tonnerre@free-electrons.com> wrote:
> +#ifdef CONFIG_CONSOLE_POLL
> +static int atmel_poll_get_char(struct uart_port *port)
> +{
> + while (!(UART_GET_CSR(port) & ATMEL_US_RXRDY))
> + barrier();
> +
> + return UART_GET_CHAR(port);
> +}
> +
> +static void atmel_poll_put_char(struct uart_port *port, unsigned char ch)
> +{
> + while (!(UART_GET_CSR(port) & ATMEL_US_TXRDY))
> + barrier();
> +
> + UART_PUT_CHAR(port, ch);
> +}
> +#endif
The use of barrier() is not appropriate here - it's purely a compiler
concept.
I'll switch it to cpu_relax(). Even that's probably unneeded, as the
IO operation is usually slow and should be an opportunity for the CPU
to take a little nap.
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2009-11-12 22:25 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-06-30 9:05 [PATCH] Add poll_get_char and poll_put_char uart_ops to atmel_serial Albin Tonnerre
2009-07-27 14:23 ` Haavard Skinnemoen
2009-07-27 15:19 ` Albin Tonnerre
2009-07-28 16:09 ` Haavard Skinnemoen
2009-09-04 15:34 ` Albin Tonnerre
2009-09-07 6:22 ` Andrew Victor
2009-09-07 9:52 ` [PATCH v2] " Albin Tonnerre
2009-09-07 18:17 ` Andrew Victor
2009-09-08 8:30 ` Haavard Skinnemoen
2009-09-11 11:31 ` Albin Tonnerre
2009-10-10 18:57 ` Albin Tonnerre
2009-11-11 11:37 ` Albin Tonnerre
2009-11-12 22:24 ` Andrew Morton
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox