linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Haavard Skinnemoen <hskinnemoen@atmel.com>
To: Marc Pignat <marc.pignat@hevs.ch>
Cc: Andrew Victor <linux@maxim.org.za>,
	kernel@avr32linux.org, linux-kernel@vger.kernel.org,
	Remy Bohmer <linux@bohmer.net>,
	Chip Coldwell <coldwell@redhat.com>
Subject: Re: [PATCH 6/6] atmel_serial: Add DMA support
Date: Wed, 23 Jan 2008 12:53:00 +0100	[thread overview]
Message-ID: <20080123125300.5d8d7006@dhcp-252-066.norway.atmel.com> (raw)
In-Reply-To: <200801221752.43830.marc.pignat@hevs.ch>

On Tue, 22 Jan 2008 17:52:43 +0100
Marc Pignat <marc.pignat@hevs.ch> wrote:

> Hi!
> 
> I removed linux-arm-kernel@lists.arm.linux.org.uk from cc, it is a
> subscriber-only list.

Right. Does that mean I shouldn't Cc it on patches?

> On Tuesday 22 January 2008, Haavard Skinnemoen wrote:
> > From: Chip Coldwell <coldwell@redhat.com>
> ...
> > @@ -47,6 +50,11 @@
> >  
> >  #include "atmel_serial.h"
> >  
> > +#define SUPPORT_PDC
> > +#define PDC_BUFFER_SIZE		(L1_CACHE_BYTES << 3)
> > +#warning "Revisit"
> why add this warning?

Dunno. I suppose the PDC_BUFFER_SIZE and/or PDC_RX_TIMEOUT definitions
needs to be revisited? Chip?

I don't really understand why the buffer size depends on the cache line
size either. Why don't we just set it to something nice and large, like
512 (actually 1024 since there are two buffers), and be done with it?

And while we're at it, might as well move the SUPPORT_PDC definition
into Kconfig where it belongs...

> ...
> > @@ -1090,7 +1434,7 @@ static int atmel_serial_suspend(struct platform_device *pdev,
> >  	struct atmel_uart_port *atmel_port = (struct atmel_uart_port *)port;
> >  
> >  	if (device_may_wakeup(&pdev->dev)
> > -	    && !at91_suspend_entering_slow_clock())
> > +		&& !clk_must_disable(atmel_port->clk))
> 1. this has nothing to do with dma
> 2. clk_must_disable isn't in mainline (2.6.24-rc8) for at91 (not verified for avr32).

Ok, I don't think this code is actually compiled on avr32 so I didn't
see the breakage. But I agree it has nothing to do with DMA, so I'll
remove it. If anything here needs fixing, it should be done as a
separate patch.

> CONFIG_MAGIC_SYSRQ isn't working with this pach, (CONFIG_MAGIC_SYSRQ has never
> worked with atmel_serial dma patches).

Yeah, I know. It's a bit difficult to fix. But this DMA patch has been
out of tree for so long that I think it's actually more important to
get it into mainline at this point, without necessarily having to fix
up problems that have been there forever.

And even with this patch, DMA support is entirely optional on a
per-port basis, so if it turns out to be (too) broken, we can simply
turn it off on the boards where it actually matters.

> For me breaking CONFIG_MAGIC_SYSRQ is not a critical regression and can be
> fixed later, but the "clk_must_disable" problem breaks compilation.

Right. The below patch should take care of this. If you're fine with
it, I'll fold it into the DMA patch in the next round.

Haavard

diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig
index d7e1996..67bfbb0 100644
--- a/drivers/serial/Kconfig
+++ b/drivers/serial/Kconfig
@@ -380,6 +380,21 @@ config SERIAL_ATMEL_CONSOLE
 	  console is the device which receives all kernel messages and
 	  warnings and which allows logins in single user mode).
 
+config SERIAL_ATMEL_PDC
+	bool "Support DMA transfers on AT91 / AT32 serial port"
+	depends on SERIAL_ATMEL
+	default y
+	help
+	  Say Y here if you wish to use the PDC to do DMA transfers to
+	  and from the Atmel AT91 / AT32 serial port. In order to
+	  actually use DMA transfers, make sure that the use_dma_tx
+	  and use_dma_rx members in the atmel_uart_data struct is set
+	  appropriately for each port.
+
+	  Note that break and error handling currently doesn't work
+	  properly when DMA is enabled. Make sure that ports where
+	  this matters don't use DMA.
+
 config SERIAL_ATMEL_TTYAT
 	bool "Install as device ttyATn instead of ttySn"
 	depends on SERIAL_ATMEL=y
diff --git a/drivers/serial/atmel_serial.c b/drivers/serial/atmel_serial.c
index cb70cc5..f4ef1df 100644
--- a/drivers/serial/atmel_serial.c
+++ b/drivers/serial/atmel_serial.c
@@ -50,9 +50,8 @@
 
 #include "atmel_serial.h"
 
-#define SUPPORT_PDC
-#define PDC_BUFFER_SIZE		(L1_CACHE_BYTES << 3)
-#warning "Revisit"
+#define PDC_BUFFER_SIZE		512
+/* Revisit: We should calculate this based on the actual port settings */
 #define PDC_RX_TIMEOUT		(3 * 10)		/* 3 bytes */
 
 #if defined(CONFIG_SERIAL_ATMEL_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ)
@@ -162,7 +161,7 @@ static struct atmel_uart_port atmel_ports[ATMEL_MAX_UART];
 static struct console atmel_console;
 #endif
 
-#ifdef SUPPORT_PDC
+#ifdef CONFIG_SERIAL_ATMEL_PDC
 static bool atmel_use_dma_rx(struct uart_port *port)
 {
 	struct atmel_uart_port *atmel_port = (struct atmel_uart_port *)port;
@@ -1434,7 +1433,7 @@ static int atmel_serial_suspend(struct platform_device *pdev,
 	struct atmel_uart_port *atmel_port = (struct atmel_uart_port *)port;
 
 	if (device_may_wakeup(&pdev->dev)
-		&& !clk_must_disable(atmel_port->clk))
+	    && !at91_suspend_entering_slow_clock())
 		enable_irq_wake(port->irq);
 	else {
 		uart_suspend_port(&atmel_uart, port);

  reply	other threads:[~2008-01-23 11:53 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-22 14:50 [PATCH v3 0/6] atmel_serial: Cleanups, irq handler splitup & DMA Haavard Skinnemoen
2008-01-22 14:50 ` [PATCH 1/6] atmel_serial: Clean up the code Haavard Skinnemoen
2008-01-22 14:50   ` [PATCH 2/6] atmel_serial: Use cpu_relax() when busy-waiting Haavard Skinnemoen
2008-01-22 14:50     ` [PATCH 3/6] atmel_serial: Use existing console options only if BRG is running Haavard Skinnemoen
2008-01-22 14:50       ` [PATCH 4/6] atmel_serial: Fix bugs in probe() error path and remove() Haavard Skinnemoen
2008-01-22 14:50         ` [PATCH 5/6] atmel_serial: Split the interrupt handler Haavard Skinnemoen
2008-01-22 14:50           ` [PATCH 6/6] atmel_serial: Add DMA support Haavard Skinnemoen
2008-01-22 16:52             ` Marc Pignat
2008-01-23 11:53               ` Haavard Skinnemoen [this message]
2008-01-23 12:30                 ` Marc Pignat
2008-01-23 12:45                   ` Haavard Skinnemoen
2008-01-23 13:18                     ` Marc Pignat
2008-01-23 13:35                       ` Haavard Skinnemoen
2008-01-23 13:52                         ` Marc Pignat
2008-01-23 14:05                           ` Haavard Skinnemoen
2008-01-23 15:04                             ` Alan Cox
2008-01-23 15:14                               ` Haavard Skinnemoen
2008-01-23 16:41                                 ` Alan Cox

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=20080123125300.5d8d7006@dhcp-252-066.norway.atmel.com \
    --to=hskinnemoen@atmel.com \
    --cc=coldwell@redhat.com \
    --cc=kernel@avr32linux.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@bohmer.net \
    --cc=linux@maxim.org.za \
    --cc=marc.pignat@hevs.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;
as well as URLs for NNTP newsgroup(s).