* [PATCH 1/2] dmaengine: shdma: restore partial transfer calculation
2012-07-30 19:28 [PATCH 0/2] serial: sh-sci: fix compilation breakage (3.6) Guennadi Liakhovetski
@ 2012-07-30 19:28 ` Guennadi Liakhovetski
2012-07-30 19:28 ` [PATCH 2/2] serial: sh-sci: fix compilation breakage, when DMA is enabled Guennadi Liakhovetski
2012-07-31 6:07 ` [PATCH 0/2] serial: sh-sci: fix compilation breakage (3.6) Paul Mundt
2 siblings, 0 replies; 5+ messages in thread
From: Guennadi Liakhovetski @ 2012-07-30 19:28 UTC (permalink / raw)
To: linux-sh
Cc: Koul, Vinod, Paul Mundt, Magnus Damm, Yoshihiro Shimoda,
linux-kernel
The recent shdma driver split has mistakenly removed support for partial
DMA transfer size calculation on forced termination. This patch restores
it.
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
---
drivers/dma/sh/shdma-base.c | 9 +++++++++
drivers/dma/sh/shdma.c | 12 ++++++++++++
include/linux/shdma-base.h | 2 ++
3 files changed, 23 insertions(+), 0 deletions(-)
diff --git a/drivers/dma/sh/shdma-base.c b/drivers/dma/sh/shdma-base.c
index 27f5c78..f4cd946 100644
--- a/drivers/dma/sh/shdma-base.c
+++ b/drivers/dma/sh/shdma-base.c
@@ -483,6 +483,7 @@ static struct shdma_desc *shdma_add_desc(struct shdma_chan *schan,
new->mark = DESC_PREPARED;
new->async_tx.flags = flags;
new->direction = direction;
+ new->partial = 0;
*len -= copy_size;
if (direction == DMA_MEM_TO_MEM || direction == DMA_MEM_TO_DEV)
@@ -644,6 +645,14 @@ static int shdma_control(struct dma_chan *chan, enum dma_ctrl_cmd cmd,
case DMA_TERMINATE_ALL:
spin_lock_irqsave(&schan->chan_lock, flags);
ops->halt_channel(schan);
+
+ if (ops->get_partial && !list_empty(&schan->ld_queue)) {
+ /* Record partial transfer */
+ struct shdma_desc *desc = list_first_entry(&schan->ld_queue,
+ struct shdma_desc, node);
+ desc->partial = ops->get_partial(schan, desc);
+ }
+
spin_unlock_irqrestore(&schan->chan_lock, flags);
shdma_chan_ld_cleanup(schan, true);
diff --git a/drivers/dma/sh/shdma.c b/drivers/dma/sh/shdma.c
index 027c9be..f41bcc5 100644
--- a/drivers/dma/sh/shdma.c
+++ b/drivers/dma/sh/shdma.c
@@ -381,6 +381,17 @@ static bool sh_dmae_chan_irq(struct shdma_chan *schan, int irq)
return true;
}
+static size_t sh_dmae_get_partial(struct shdma_chan *schan,
+ struct shdma_desc *sdesc)
+{
+ struct sh_dmae_chan *sh_chan = container_of(schan, struct sh_dmae_chan,
+ shdma_chan);
+ struct sh_dmae_desc *sh_desc = container_of(sdesc,
+ struct sh_dmae_desc, shdma_desc);
+ return (sh_desc->hw.tcr - sh_dmae_readl(sh_chan, TCR)) <<
+ sh_chan->xmit_shift;
+}
+
/* Called from error IRQ or NMI */
static bool sh_dmae_reset(struct sh_dmae_device *shdev)
{
@@ -632,6 +643,7 @@ static const struct shdma_ops sh_dmae_shdma_ops = {
.start_xfer = sh_dmae_start_xfer,
.embedded_desc = sh_dmae_embedded_desc,
.chan_irq = sh_dmae_chan_irq,
+ .get_partial = sh_dmae_get_partial,
};
static int __devinit sh_dmae_probe(struct platform_device *pdev)
diff --git a/include/linux/shdma-base.h b/include/linux/shdma-base.h
index 93f9821..a3728bf 100644
--- a/include/linux/shdma-base.h
+++ b/include/linux/shdma-base.h
@@ -50,6 +50,7 @@ struct shdma_desc {
struct list_head node;
struct dma_async_tx_descriptor async_tx;
enum dma_transfer_direction direction;
+ size_t partial;
dma_cookie_t cookie;
int chunks;
int mark;
@@ -98,6 +99,7 @@ struct shdma_ops {
void (*start_xfer)(struct shdma_chan *, struct shdma_desc *);
struct shdma_desc *(*embedded_desc)(void *, int);
bool (*chan_irq)(struct shdma_chan *, int);
+ size_t (*get_partial)(struct shdma_chan *, struct shdma_desc *);
};
struct shdma_dev {
--
1.7.2.5
^ permalink raw reply related [flat|nested] 5+ messages in thread* [PATCH 2/2] serial: sh-sci: fix compilation breakage, when DMA is enabled
2012-07-30 19:28 [PATCH 0/2] serial: sh-sci: fix compilation breakage (3.6) Guennadi Liakhovetski
2012-07-30 19:28 ` [PATCH 1/2] dmaengine: shdma: restore partial transfer calculation Guennadi Liakhovetski
@ 2012-07-30 19:28 ` Guennadi Liakhovetski
2012-07-31 6:07 ` [PATCH 0/2] serial: sh-sci: fix compilation breakage (3.6) Paul Mundt
2 siblings, 0 replies; 5+ messages in thread
From: Guennadi Liakhovetski @ 2012-07-30 19:28 UTC (permalink / raw)
To: linux-sh
Cc: Koul, Vinod, Paul Mundt, Magnus Damm, Yoshihiro Shimoda,
linux-kernel
A recent commit:
commit d6fa5a4e7ab605370fd6c982782f84ef2e6660e7
Author: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
serial: sh-sci: prepare for conversion to the shdma base library
is not sufficient to update the sh-sci driver to the new shdma driver
layout. This caused compilation breakage, when CONFIG_SERIAL_SH_SCI_DMA
is enabled. This patch trivially fixes the problem by updating the DMA
descriptor manipulation code.
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
---
drivers/tty/serial/sh-sci.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c
index d4d8c94..9be296c 100644
--- a/drivers/tty/serial/sh-sci.c
+++ b/drivers/tty/serial/sh-sci.c
@@ -25,6 +25,7 @@
#include <linux/module.h>
#include <linux/errno.h>
+#include <linux/sh_dma.h>
#include <linux/timer.h>
#include <linux/interrupt.h>
#include <linux/tty.h>
@@ -1410,8 +1411,8 @@ static void work_fn_rx(struct work_struct *work)
/* Handle incomplete DMA receive */
struct tty_struct *tty = port->state->port.tty;
struct dma_chan *chan = s->chan_rx;
- struct sh_desc *sh_desc = container_of(desc, struct sh_desc,
- async_tx);
+ struct shdma_desc *sh_desc = container_of(desc,
+ struct shdma_desc, async_tx);
unsigned long flags;
int count;
--
1.7.2.5
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH 0/2] serial: sh-sci: fix compilation breakage (3.6)
2012-07-30 19:28 [PATCH 0/2] serial: sh-sci: fix compilation breakage (3.6) Guennadi Liakhovetski
2012-07-30 19:28 ` [PATCH 1/2] dmaengine: shdma: restore partial transfer calculation Guennadi Liakhovetski
2012-07-30 19:28 ` [PATCH 2/2] serial: sh-sci: fix compilation breakage, when DMA is enabled Guennadi Liakhovetski
@ 2012-07-31 6:07 ` Paul Mundt
2012-07-31 6:44 ` Vinod Koul
2 siblings, 1 reply; 5+ messages in thread
From: Paul Mundt @ 2012-07-31 6:07 UTC (permalink / raw)
To: Guennadi Liakhovetski
Cc: linux-sh, Koul, Vinod, Magnus Damm, Yoshihiro Shimoda,
linux-kernel
On Mon, Jul 30, 2012 at 09:28:18PM +0200, Guennadi Liakhovetski wrote:
> Hi all
>
> as has been reported in this
>
> http://thread.gmane.org/gmane.linux.kernel/1294256/focus=16001
>
> thread, currently sh-sci doesn't comiple in the mainline and in -next if
> CONFIG_SERIAL_SH_SCI_DMA is enabled. This patch series fixes this
> breakage.
>
Looks alright to me. Vinod, how do you want to handle this? I can roll
both of these patches in to my tree with your Acked-by, or I can provide
you with mine for the sh-sci bits if you want to take it via yours. I'm
planning on sending my next round of updates to Linus in the next couple
of days.
^ permalink raw reply [flat|nested] 5+ messages in thread