Skip to contentSkip to conversation

ep93xx DMA patches

PATCH In review Mika Westerberg 5 participants 36 messages May 29, 2011 – Nov 23, 2011

Subsystems (7)
lore
Share & tools
lore
#0 lore raw

v2 cover ep93xx DMA patches

This is an updated version of the ep93xx DMA patches. Previous version can be found here: https://lkml.org/lkml/2011/5/22/86.

Changes to v1:
* removed unnecessary header
* corrected SPI driver documentation
* DMA driver platform code is only compiled when CONFIG_EP93XX_DMA is enabled

I tried to put all the acks in place, hope I got them right.

There is a dependency between patch 1 and patch 4 which I'm not entirely sure how to solve. Basically it is required that we have patch 1 applied before patch 4 or merge conflict results.

Otherwise it shouldn't matter in which order the patches arrive to the mainline.

Unless someone has a better idea, I suggest that these patches will go through their respective subsystem trees. All the maintainers should be copied.

Thanks,
MW

Mika Westerberg (5):
dmaengine: add ep93xx DMA support
ep93xx: add dmaengine platform code
ASoC: ep93xx: convert to use the DMA engine API
ep93xx: remove the old M2P DMA code
spi/ep93xx: add DMA support

 Documentation/spi/ep93xx_spi                   |   10 +
 arch/arm/mach-ep93xx/Makefile                  |    4 +-
 arch/arm/mach-ep93xx/core.c                    |    6 +-
 arch/arm/mach-ep93xx/dma-m2p.c                 |  411 -------
 arch/arm/mach-ep93xx/dma.c                     |  108 ++
 arch/arm/mach-ep93xx/include/mach/dma.h        |  190 ++---
 arch/arm/mach-ep93xx/include/mach/ep93xx_spi.h |    2 +
 drivers/dma/Kconfig                            |    7 +
 drivers/dma/Makefile                           |    1 +
 drivers/dma/ep93xx_dma.c                       | 1355 ++++++++++++++++++++++++
 drivers/spi/ep93xx_spi.c                       |  303 +++++-
 sound/soc/ep93xx/ep93xx-ac97.c                 |    4 +-
 sound/soc/ep93xx/ep93xx-i2s.c                  |    4 +-
 sound/soc/ep93xx/ep93xx-pcm.c                  |  137 ++--
 14 files changed, 1930 insertions(+), 612 deletions(-)
 delete mode 100644 arch/arm/mach-ep93xx/dma-m2p.c
 create mode 100644 arch/arm/mach-ep93xx/dma.c
 create mode 100644 drivers/dma/ep93xx_dma.c
Signature · 1 line
1.7.4.4
#1 lore raw

PATCH v2 1/5 dmaengine: add ep93xx DMA support

The ep93xx DMA controller has 10 independent memory to peripheral (M2P) channels, and 2 dedicated memory to memory (M2M) channels. M2M channels can also be used by SPI and IDE to perform DMA transfers to/from their memory mapped FIFOs.

This driver supports both M2P and M2M channels with DMA_SLAVE, DMA_CYCLIC and DMA_MEMCPY (M2M only) capabilities.

---
 arch/arm/mach-ep93xx/include/mach/dma.h |   87 ++
 drivers/dma/Kconfig                     |    7 +
 drivers/dma/Makefile                    |    1 +
 drivers/dma/ep93xx_dma.c                | 1355 +++++++++++++++++++++++++++++++
 4 files changed, 1450 insertions(+), 0 deletions(-)
 create mode 100644 drivers/dma/ep93xx_dma.c
arch/arm/mach-ep93xx/include/mach/dma.h +87 -0
index 5e31b2b..6e7049a 100644
@@ -15,6 +15,8 @@
 
 #include <linux/list.h>
 #include <linux/types.h>
+#include <linux/dmaengine.h>
+#include <linux/dma-mapping.h>
 
 /**
  * struct ep93xx_dma_buffer - Information about a buffer to be transferred
@@ -146,4 +148,89 @@ void ep93xx_dma_m2p_submit_recursive(struct ep93xx_dma_m2p_client *m2p,
  */
 void ep93xx_dma_m2p_flush(struct ep93xx_dma_m2p_client *m2p);
 
+/*
+ * M2P channels.
+ *
+ * Note that these values are also directly used for setting the PPALLOC
+ * register.
+ */
+#define EP93XX_DMA_I2S1		0
+#define EP93XX_DMA_I2S2		1
+#define EP93XX_DMA_AAC1		2
+#define EP93XX_DMA_AAC2		3
+#define EP93XX_DMA_AAC3		4
+#define EP93XX_DMA_I2S3		5
+#define EP93XX_DMA_UART1	6
+#define EP93XX_DMA_UART2	7
+#define EP93XX_DMA_UART3	8
+#define EP93XX_DMA_IRDA		9
+/* M2M channels */
+#define EP93XX_DMA_SSP		10
+#define EP93XX_DMA_IDE		11
+
+/**
+ * struct ep93xx_dma_data - configuration data for the EP93xx dmaengine
+ * @port: peripheral which is requesting the channel
+ * @direction: TX/RX channel
+ * @name: optional name for the channel, this is displayed in /proc/interrupts
+ *
+ * This information is passed as private channel parameter in a filter
+ * function. Note that this is only needed for slave/cyclic channels.  For
+ * memcpy channels %NULL data should be passed.
+ */
+struct ep93xx_dma_data {
+	int				port;
+	enum dma_data_direction		direction;
+	const char			*name;
+};
+
+/**
+ * struct ep93xx_dma_chan_data - platform specific data for a DMA channel
+ * @name: name of the channel, used for getting the right clock for the channel
+ * @base: mapped registers
+ * @irq: interrupt number used by this channel
+ */
+struct ep93xx_dma_chan_data {
+	const char			*name;
+	void __iomem			*base;
+	int				irq;
+};
+
+/**
+ * struct ep93xx_dma_platform_data - platform data for the dmaengine driver
+ * @channels: array of channels which are passed to the driver
+ * @num_channels: number of channels in the array
+ *
+ * This structure is passed to the DMA engine driver via platform data. For
+ * M2P channels, contract is that even channels are for TX and odd for RX.
+ * There is no requirement for the M2M channels.
+ */
+struct ep93xx_dma_platform_data {
+	struct ep93xx_dma_chan_data	*channels;
+	size_t				num_channels;
+};
+
+static inline bool ep93xx_dma_chan_is_m2p(struct dma_chan *chan)
+{
+	return !strcmp(dev_name(chan->device->dev), "ep93xx-dma-m2p");
+}
+
+/**
+ * ep93xx_dma_chan_direction - returns direction the channel can be used
+ * @chan: channel
+ *
+ * This function can be used in filter functions to find out whether the
+ * channel supports given DMA direction. Only M2P channels have such
+ * limitation, for M2M channels the direction is configurable.
+ */
+static inline enum dma_data_direction
+ep93xx_dma_chan_direction(struct dma_chan *chan)
+{
+	if (!ep93xx_dma_chan_is_m2p(chan))
+		return DMA_NONE;
+
+	/* even channels are for TX, odd for RX */
+	return (chan->chan_id % 2 == 0) ? DMA_TO_DEVICE : DMA_FROM_DEVICE;
+}
+
 #endif /* __ASM_ARCH_DMA_H */
drivers/dma/Kconfig +7 -0
index a572600..614ce7b 100644
@@ -235,6 +235,13 @@ config MXS_DMA
 	  Support the MXS DMA engine. This engine including APBH-DMA
 	  and APBX-DMA is integrated into Freescale i.MX23/28 chips.
 
+config EP93XX_DMA
+	bool "Cirrus Logic EP93xx DMA support"
+	depends on ARCH_EP93XX
+	select DMA_ENGINE
+	help
+	  Enable support for the Cirrus Logic EP93xx M2P/M2M DMA controller.
+
 config DMA_ENGINE
 	bool
 
drivers/dma/Makefile +1 -0
index 836095a..30cf3b1 100644
@@ -25,3 +25,4 @@ obj-$(CONFIG_STE_DMA40) += ste_dma40.o ste_dma40_ll.o
 obj-$(CONFIG_PL330_DMA) += pl330.o
 obj-$(CONFIG_PCH_DMA) += pch_dma.o
 obj-$(CONFIG_AMBA_PL08X) += amba-pl08x.o
+obj-$(CONFIG_EP93XX_DMA) += ep93xx_dma.o
drivers/dma/ep93xx_dma.c new file +1355 -0

1,355 lines not on this page · raw message

Signature · 1 line
1.7.4.4
#2 lore raw

Re: [PATCH v2 1/5] dmaengine: add ep93xx DMA support

Hello.

During adaptation of my experimental ep93xx ide driver to the new dmaengine api, I discovered two issues with ep93xx dma implementation:
1) Control register is incorrectly programmed for IDE (m2m_hw_setup), probably copy-paste bug ;)
2) Kernel oops when trying to stop running transfers by calling dmaengine_terminate_all(...) - caused by dereferencing empty list in ep93xx_dma_get_active

Following is a patch, which solves these problems for me.

Regards,
Rafal Prylowski

drivers/dma/ep93xx_dma.c +17 -12
Index: linux-2.6/drivers/dma/ep93xx_dma.c
===================================================================
@@ -246,6 +246,7 @@ static void ep93xx_dma_set_active(struct
 static struct ep93xx_dma_desc *
 ep93xx_dma_get_active(struct ep93xx_dma_chan *edmac)
 {
+	BUG_ON(list_empty(&edmac->active));
 	return list_first_entry(&edmac->active, struct ep93xx_dma_desc, node);
 }
 
@@ -459,9 +460,6 @@ static int m2m_hw_setup(struct ep93xx_dm
 		 * This IDE part is totally untested. Values below are taken
 		 * from the EP93xx Users's Guide and might not be correct.
 		 */
-		control |= M2M_CONTROL_NO_HDSK;
-		control |= M2M_CONTROL_RSS_IDE;
-		control |= M2M_CONTROL_PW_16;
 
 		if (data->direction == DMA_TO_DEVICE) {
 			/* Worst case from the UG */
@@ -473,6 +471,9 @@ static int m2m_hw_setup(struct ep93xx_dm
 			control |= M2M_CONTROL_SAH;
 			control |= M2M_CONTROL_TM_RX;
 		}
+		control |= M2M_CONTROL_NO_HDSK;
+		control |= M2M_CONTROL_RSS_IDE;
+		control |= M2M_CONTROL_PW_16;
 		break;
 
 	default:
@@ -668,24 +669,28 @@ static void ep93xx_dma_unmap_buffers(str
 static void ep93xx_dma_tasklet(unsigned long data)
 {
 	struct ep93xx_dma_chan *edmac = (struct ep93xx_dma_chan *)data;
-	struct ep93xx_dma_desc *desc, *d;
-	dma_async_tx_callback callback;
-	void *callback_param;
+	struct ep93xx_dma_desc *desc = NULL, *d;
+	dma_async_tx_callback callback = NULL;
+	void *callback_param = NULL;
 	LIST_HEAD(list);
 
 	spin_lock_irq(&edmac->lock);
-	desc = ep93xx_dma_get_active(edmac);
-	if (desc->complete) {
-		edmac->last_completed = desc->txd.cookie;
-		list_splice_init(&edmac->active, &list);
+	if (!list_empty(&edmac->active)) {
+		desc = ep93xx_dma_get_active(edmac);
+		if (desc->complete) {
+			edmac->last_completed = desc->txd.cookie;
+			list_splice_init(&edmac->active, &list);
+		}
 	}
 	spin_unlock_irq(&edmac->lock);
 
 	/* Pick up the next descriptor from the queue */
 	ep93xx_dma_advance_work(edmac);
 
-	callback = desc->txd.callback;
-	callback_param = desc->txd.callback_param;
+	if (desc) {
+		callback = desc->txd.callback;
+		callback_param = desc->txd.callback_param;
+	}
 
 	/* Now we can release all the chained descriptors */
 	list_for_each_entry_safe(desc, d, &list, node) {
#3 lore raw

RE: [PATCH v2 1/5] dmaengine: add ep93xx DMA support

Quoted 5 lines · Rafal Prylowski

Hello.

During adaptation of my experimental ep93xx ide driver to the new dmaengine api, I discovered two issues with ep93xx dma implementation:

Nice to see someone is trying to get IDE support for the ep93xx into mainline! Unfortunately none of my ep93xx hardware supports IDE... :-(

Quoted 16 lines

1) Control register is incorrectly programmed for IDE (m2m_hw_setup), probably copy-paste bug ;)
2) Kernel oops when trying to stop running transfers by calling dmaengine_terminate_all(...) - caused by dereferencing empty list in ep93xx_dma_get_active

Following is a patch, which solves these problems for me.

Regards,
Rafal Prylowski

Index: linux-2.6/drivers/dma/ep93xx_dma.c
===================================================================

drivers/dma/ep93xx_dma.c static void ep93xx_dma_set_active(struct · line 249

Quoted 4 lines
drivers/dma/ep93xx_dma.c +1 -0
@@ -246,6 +246,7 @@ static void ep93xx_dma_set_active(struct
 static struct ep93xx_dma_desc *
 ep93xx_dma_get_active(struct ep93xx_dma_chan *edmac)
 {
+	BUG_ON(list_empty(&edmac->active));

BUG_ON is evil...

I'm not sure this is the right way to handle this.

If your doing dma the list should never be empty. If it is I think it should have been caught way before this. Mika, do you have any comments?

Quoted 14 lines
drivers/dma/ep93xx_dma.c +0 -3
 	return list_first_entry(&edmac->active, struct ep93xx_dma_desc, node);
 }
 
@@ -459,9 +460,6 @@ static int m2m_hw_setup(struct ep93xx_dm
 		 * This IDE part is totally untested. Values below are taken
 		 * from the EP93xx Users's Guide and might not be correct.
 		 */
-		control |= M2M_CONTROL_NO_HDSK;
-		control |= M2M_CONTROL_RSS_IDE;
-		control |= M2M_CONTROL_PW_16;
 
 		if (data->direction == DMA_TO_DEVICE) {
 			/* Worst case from the UG */

drivers/dma/ep93xx_dma.c static int m2m_hw_setup(struct ep93xx_dm · line 477

Quoted 7 lines
drivers/dma/ep93xx_dma.c +3 -0
@@ -473,6 +471,9 @@ static int m2m_hw_setup(struct ep93xx_dm
 			control |= M2M_CONTROL_SAH;
 			control |= M2M_CONTROL_TM_RX;
 		}
+		control |= M2M_CONTROL_NO_HDSK;
+		control |= M2M_CONTROL_RSS_IDE;
+		control |= M2M_CONTROL_PW_16;
 		break;

This looks right. The common OR'ed in bits should be added after setting the direction bits.

Quoted 14 lines
drivers/dma/ep93xx_dma.c +3 -3
 	default:
@@ -668,24 +669,28 @@ static void ep93xx_dma_unmap_buffers(str
 static void ep93xx_dma_tasklet(unsigned long data)
 {
 	struct ep93xx_dma_chan *edmac = (struct ep93xx_dma_chan *)data;
-	struct ep93xx_dma_desc *desc, *d;
-	dma_async_tx_callback callback;
-	void *callback_param;
+	struct ep93xx_dma_desc *desc = NULL, *d;
+	dma_async_tx_callback callback = NULL;
+	void *callback_param = NULL;
 	LIST_HEAD(list);
 
 	spin_lock_irq(&edmac->lock);

drivers/dma/ep93xx_dma.c static void ep93xx_dma_unmap_buffers(str · line 683

Quoted 10 lines
drivers/dma/ep93xx_dma.c +6 -4
-	desc = ep93xx_dma_get_active(edmac);
-	if (desc->complete) {
-		edmac->last_completed = desc->txd.cookie;
-		list_splice_init(&edmac->active, &list);
+	if (!list_empty(&edmac->active)) {
+		desc = ep93xx_dma_get_active(edmac);
+		if (desc->complete) {
+			edmac->last_completed = desc->txd.cookie;
+			list_splice_init(&edmac->active, &list);
+		}

It looks like this might actually catch your BUG_ON issue above.

drivers/dma/ep93xx_dma.c static void ep93xx_dma_unmap_buffers(str · line 693

Quoted 12 lines
drivers/dma/ep93xx_dma.c +4 -2
 	}
 	spin_unlock_irq(&edmac->lock);
 
 	/* Pick up the next descriptor from the queue */
 	ep93xx_dma_advance_work(edmac);
 
-	callback = desc->txd.callback;
-	callback_param = desc->txd.callback_param;
+	if (desc) {
+		callback = desc->txd.callback;
+		callback_param = desc->txd.callback_param;
+	}

These could be moved up to where 'desc' is getting set. You have already verified that the list is not empty and have a valid 'desc' pointer. Set the callback pointers there to remove this extra if (desc) test.

drivers/dma/ep93xx_dma.c static void ep93xx_dma_unmap_buffers(str · line 696

Quoted 3 lines
drivers/dma/ep93xx_dma.c +0 -0
 	/* Now we can release all the chained descriptors */
 	list_for_each_entry_safe(desc, d, &list, node) {

Thanks,
Hartley

#4 lore raw

Re: [PATCH v2 1/5] dmaengine: add ep93xx DMA support

Quoted 13 lines · H Hartley Sweeten

drivers/dma/ep93xx_dma.c static void ep93xx_dma_set_active(struct · line 249

Quoted 10 lines

Index: linux-2.6/drivers/dma/ep93xx_dma.c
===================================================================

drivers/dma/ep93xx_dma.c +1 -0
@@ -246,6 +246,7 @@ static void ep93xx_dma_set_active(struct
 static struct ep93xx_dma_desc *
 ep93xx_dma_get_active(struct ep93xx_dma_chan *edmac)
 {
+	BUG_ON(list_empty(&edmac->active));

BUG_ON is evil...

Quoted 4 lines

I'm not sure this is the right way to handle this.

If your doing dma the list should never be empty. If it is I think it should have been caught way before this. Mika, do you have any comments?

I agree - the list should never be empty when this is called. The actual bug is somewhere else.

#5 lore raw

Re: [PATCH v2 1/5] dmaengine: add ep93xx DMA support

In reply to H Hartley Sweeten

Hello.

Quoted 3 lines

Nice to see someone is trying to get IDE support for the ep93xx into mainline! Unfortunately none of my ep93xx hardware supports IDE... :-(

This driver is a result of work of several people, which I've seen on linux-ide mailing list. I only added this dmaengine support. I really would like to see it in mainline, but I think it's still not ready for inclusion.

Quoted 13 lines
Quoted 13 lines
(quoted diff) +3 -3
 	default:
@@ -668,24 +669,28 @@ static void ep93xx_dma_unmap_buffers(str
 static void ep93xx_dma_tasklet(unsigned long data)
 {
 	struct ep93xx_dma_chan *edmac = (struct ep93xx_dma_chan *)data;
-	struct ep93xx_dma_desc *desc, *d;
-	dma_async_tx_callback callback;
-	void *callback_param;
+	struct ep93xx_dma_desc *desc = NULL, *d;
+	dma_async_tx_callback callback = NULL;
+	void *callback_param = NULL;
 	LIST_HEAD(list);
 
Quoted 13 lines

Review static void ep93xx_dma_unmap_buffers(str · line 683

Quoted 11 lines
(quoted diff) +6 -4
 	spin_lock_irq(&edmac->lock);
-	desc = ep93xx_dma_get_active(edmac);
-	if (desc->complete) {
-		edmac->last_completed = desc->txd.cookie;
-		list_splice_init(&edmac->active, &list);
+	if (!list_empty(&edmac->active)) {
+		desc = ep93xx_dma_get_active(edmac);
+		if (desc->complete) {
+			edmac->last_completed = desc->txd.cookie;
+			list_splice_init(&edmac->active, &list);
+		}

It looks like this might actually catch your BUG_ON issue above.

Yes, I only inserted BUG_ON in ep93xx_dma_get_active() to be sure, that nowhere else in code happens similar problem.
But now I'm not so sure, that I encountered bug in ep93xx_dma.c, or maybe I'm misusing dmaengine api (calling dmaengine_termiante_all from invalid context?). I don't have enough knowledge to judge this.

Quoted 7 lines
Quoted 7 lines
(quoted diff) +0 -0
 	}
 	spin_unlock_irq(&edmac->lock);
 
 	/* Pick up the next descriptor from the queue */
 	ep93xx_dma_advance_work(edmac);
 
Quoted 11 lines

Review static void ep93xx_dma_unmap_buffers(str · line 693

Quoted 6 lines
(quoted diff) +4 -2
-	callback = desc->txd.callback;
-	callback_param = desc->txd.callback_param;
+	if (desc) {
+		callback = desc->txd.callback;
+		callback_param = desc->txd.callback_param;
+	}

These could be moved up to where 'desc' is getting set. You have already verified that the list is not empty and have a valid 'desc' pointer. Set the callback pointers there to remove this extra if (desc) test.

Following is a patch with suggestions applied (patch addressing problem with incorrect programming of control register is in another mail sent in reply to Mika Westerberg).

Regards,
Rafal Prylowski.

drivers/dma/ep93xx_dma.c +10 -9
Index: linux-2.6/drivers/dma/ep93xx_dma.c
===================================================================
@@ -669,24 +669,25 @@ static void ep93xx_dma_tasklet(unsigned 
 {
 	struct ep93xx_dma_chan *edmac = (struct ep93xx_dma_chan *)data;
 	struct ep93xx_dma_desc *desc, *d;
-	dma_async_tx_callback callback;
-	void *callback_param;
+	dma_async_tx_callback callback = NULL;
+	void *callback_param = NULL;
 	LIST_HEAD(list);
 
 	spin_lock_irq(&edmac->lock);
-	desc = ep93xx_dma_get_active(edmac);
-	if (desc->complete) {
-		edmac->last_completed = desc->txd.cookie;
-		list_splice_init(&edmac->active, &list);
+	if (!list_empty(&edmac->active)) {
+		desc = ep93xx_dma_get_active(edmac);
+		if (desc->complete) {
+			edmac->last_completed = desc->txd.cookie;
+			list_splice_init(&edmac->active, &list);
+		}
+		callback = desc->txd.callback;
+		callback_param = desc->txd.callback_param;
 	}
 	spin_unlock_irq(&edmac->lock);
 
 	/* Pick up the next descriptor from the queue */
 	ep93xx_dma_advance_work(edmac);
 
-	callback = desc->txd.callback;
-	callback_param = desc->txd.callback_param;
-
 	/* Now we can release all the chained descriptors */
 	list_for_each_entry_safe(desc, d, &list, node) {
 		/*
#6 lore raw

Re: [PATCH v2 1/5] dmaengine: add ep93xx DMA support

In reply to Rafal Prylowski
Quoted 3 lines · Rafal Prylowski

1) Control register is incorrectly programmed for IDE (m2m_hw_setup), probably copy-paste bug ;)

Yes, this is certainly a copy-paste bug or something. Thanks for fixing :)

Can you send a separate patch for this? Make sure you Cc Vinod Koul as he is the maintainer of slave dma subsystem.

Quoted 3 lines

2) Kernel oops when trying to stop running transfers by calling dmaengine_terminate_all(...) - caused by dereferencing empty list in ep93xx_dma_get_active

Can you post that OOPS log? I would like to understand this problem a bit better before we do any fixes for the driver.

#7 lore raw

Re: [PATCH v2 1/5] dmaengine: add ep93xx DMA support

Hello.

W dniu 2011-11-16 07:55, Mika Westerberg pisze:

Quoted 4 lines

Yes, this is certainly a copy-paste bug or something. Thanks for fixing :)

Can you send a separate patch for this? Make sure you Cc Vinod Koul as he is the maintainer of slave dma subsystem.

Here is a separate patch:

drivers/dma/ep93xx_dma.c +3 -3
Index: linux-2.6/drivers/dma/ep93xx_dma.c
===================================================================
@@ -459,9 +459,6 @@ static int m2m_hw_setup(struct ep93xx_dm
 		 * This IDE part is totally untested. Values below are taken
 		 * from the EP93xx Users's Guide and might not be correct.
 		 */
-		control |= M2M_CONTROL_NO_HDSK;
-		control |= M2M_CONTROL_RSS_IDE;
-		control |= M2M_CONTROL_PW_16;
 
 		if (data->direction == DMA_TO_DEVICE) {
 			/* Worst case from the UG */
@@ -473,6 +470,9 @@ static int m2m_hw_setup(struct ep93xx_dm
 			control |= M2M_CONTROL_SAH;
 			control |= M2M_CONTROL_TM_RX;
 		}
+		control |= M2M_CONTROL_NO_HDSK;
+		control |= M2M_CONTROL_RSS_IDE;
+		control |= M2M_CONTROL_PW_16;
 		break;
 
 	default:
Quoted 8 lines
Quoted 4 lines

2) Kernel oops when trying to stop running transfers by calling dmaengine_terminate_all(...) - caused by dereferencing empty list in ep93xx_dma_get_active

Can you post that OOPS log? I would like to understand this problem a bit better before we do any fixes for the driver.

OOPS log:

Linux version 3.2.0-rc1EP-1+ (prylowski at server) (gcc version 4.4.2 (GCC) ) #1008
Wed Nov 16 08:25:45 CET 2011
CPU: ARM920T [41129200] revision 0 (ARMv4T), cr=c0007177
CPU: VIVT data cache, VIVT instruction cache
Machine: Metasoft FonTel EP Board
Memory policy: ECC disabled, Data cache writeback
Built 1 zonelists in Zone order, mobility grouping on. Total pages: 8128 Kernel command line: mtdparts=physmap-flash.0:128K(uboot),1152K(kernel),15104K(r ootfs) root=/dev/mtdblock2 rootfstype=jffs2 console=ttyAM0 init=/sbin/init early printk lpj=496128 panic=2
PID hash table entries: 128 (order: -3, 512 bytes)
Dentry cache hash table entries: 4096 (order: 2, 16384 bytes) Inode-cache hash table entries: 2048 (order: 1, 8192 bytes)
Memory: 32MB = 32MB total
Memory: 27452k/27452k available, 5316k reserved, 0K highmem
Virtual kernel memory layout:

    vector  : 0xffff0000 - 0xffff1000   (   4 kB)
    fixmap  : 0xfff00000 - 0xfffe0000   ( 896 kB)
    vmalloc : 0xc2800000 - 0xfe800000   ( 960 MB)
    lowmem  : 0xc0000000 - 0xc2000000   (  32 MB)
    modules : 0xbf000000 -0xc0000000   (  16 MB)
      .text : 0xc0008000 - 0xc029d000   (2644 kB)
      .init : 0xc029d000 - 0xc02b6000   ( 100 kB)
      .data : 0xc02b6000 - 0xc02d1440   ( 110 kB)
       .bss : 0xc02d1464 - 0xc02df51c   (  57 kB)

SLUB: Genslabs=13, HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1 NR_IRQS:120
VIC @fefb0000: id 0x00041190, vendor 0x41
VIC @fefc0000: id 0x00041190, vendor 0x41
Console: colour dummy device 80x30
Calibrating delay loop (skipped) preset value.. 99.22 BogoMIPS (lpj=496128)
pid_max: default: 32768 minimum: 301
Mount-cache hash table entries: 512
CPU: Testing write buffer coherency: ok
NET: Registered protocol family 16
ep93xx clock: PLL1 running at 400 MHz, PLL2 at 192 MHz
ep93xx clock: FCLK 200 MHz, HCLK 100 MHz, PCLK 50 MHz
bio: create slab <bio-0> at 0
ep93xx-dma ep93xx-dma-m2p: EP93xx M2P DMA ready
ep93xx-dma ep93xx-dma-m2m: EP93xx M2M DMA ready
SCSI subsystem initialized
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
i2c-gpio i2c-gpio.0: using pins 49 (SDA) and 48 (SCL)
NET: Registered protocol family 2
IP route cache hash table entries: 1024 (order: 0, 4096 bytes)
TCP established hash table entries: 1024 (order: 1, 8192 bytes)
TCP bind hash table entries: 1024 (order: 0, 4096 bytes)
TCP: Hash tables configured (established 1024 bind 1024)
TCP reno registered
UDP hashable entries: 256 (order: 0, 4096 bytes)
UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
NET: Registered protocol family 1
JFFS2 version 2.2. (NAND) ?? 2001-2006 Red Hat, Inc.
msgmni has been set to 53
io scheduler noop registered
io scheduler deadline registered (default)
Serial: AMBA driver
apb:uart1: ttyAM0 at MMIO 0x808c0000 (irq = 52) is a AMBA
console [ttyAM0] enabled
apb:uart2: ttyAM1 at MMIO 0x808d0000 (irq = 54) is a AMBA apb:uart3: ttyAM2 at MMIO 0x808e0000 (irq = 55) is a AMBA fontel-pri fontel-pri: FonTel PRI initialized correctly.
ep93xx-ide ep93xx-ide: version 0.5
scsi0 : ep93xx-ide
ata1: PATA max UDMA/66 irq 40
physmap platform flash device: 01000000 at 60000000 physmap-flash.0: Found 1 x16 devices at 0x0 in 16-bit bank. Manufacturer ID 0x00 0001 Chip ID 0x002101
Amd/Fujitsu Extended Query Table at 0x0040
Amd/Fujitsu Extended Query version 1.3.
number of CFI chips: 1
3 cmdlinepart partitions found on MTD device physmap-flash.0 Creating 3 MTD partitions on "physmap-flash.0":
0x000000000000-0x000000020000 : "uboot" 0x000000020000-0x000000140000 : "kernel" 0x000000140000-0x000001000000 : "rootfs"
ep93xx-spi ep93xx-spi.0: EP93xx SPI Controller at 0x808a0000 irq 53 ep93xx-eth version 0.1 loading
eth0: ep93xx on-chip ethernet, IRQ 39, 8e:42:5c:13:29:4c
ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
ep93xx-ohci ep93xx-ohci: EP93xx OHCI
ep93xx-ohci ep93xx-ohci: new USB bus registered, assigned bus number 1 ep93xx-ohci ep93xx-ohci: irq 56, io mem 0x80020000
hub 1-0:1.0: USB hub found
hub 1-0:1.0: 3 ports detected
Initializing USB Mass Storage driver...
usbcore: registered new interface driver usb-storage
USB Mass Storage support registered.
usbcore: registered new interface driver fontel
rtc-ds1307 0-0068: rtc core: registered ds1307 as rtc0
rtc-ds1307 0-0068: 56 bytes nvram
ep93xx-rtc ep93xx-rtc: rtc core: registered ep93xx-rtc as rtc1 Software Watchdog Timer: 0.07 initialized. soft_noboot=0 soft_margin=60 sec soft _panic=0 (nowayout= 0)
TCP cubic registered
NET: Registered protocol family 17
NET: Registered protocol family 15
ep93xx-rtc ep93xx-rtc: setting system clock to 1970-01-01 00:00:07 UTC (7) ata1.00: ATA-8: WDC WD3200BEVE-00A0HT0, 11.01A11, max UDMA/100 ata1.00: 625142448 sectors, multi 0: LBA48
ata1.00: configured for UDMA/66
scsi 0:0:0:0: Direct-Access ATA WDC WD3200BEVE-0 11.0 PQ: 0 ANSI: 5
sd 0:0:0:0: [sda] 625142448 512-byte logical blocks: (320 GB/298 GiB) sd 0:0:0:0: [sda] Write Protect is off
sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO
or FUA

Internal error: Oops - undefined instruction: 0 [#1]
CPU: 0    Not tainted  (3.2.0-rc1EP-1+ #1008)
PC is at 0xc184c868
LR is at ep93xx_dma_tasklet+0xec/0x164
pc : [<c184c868>]    lr : [<c012b528>]    psr: 00000013

sp : c02b7e70 ip : ffffffff fp : c02b7ea4
r10: 00000100 r9 : 80000013 r8 : c02b7e50
r7 : c02b7e70 r6 : c02b7ea4 r5 : 000000a4 r4 : c02b7e70 r3 : c02b751d r2 : 8ae34598 r1 : c184c6e0 r0 : c02b7ea4
Flags: nzcv IRQs on FIQs on Mode SVC_32 ISA ARM Segment kernel
Control: c000717f Table: c0004000 DAC: 00000017 Process swapper (pid: 0, stack limit = 0xc02b6270)

Stack: (0xc02b7e70 to 0xc02b8000)

7e60: c02b7ea4 c02b7e70 c0008b64 c02bd5c4
7e80: c02d60e0 00000000 00000000 c02bd44c c02d60e0 00000100 c02b7ec4 c02b7ea8 7ea0: c001c49c c012b44c 00000018 00000001 c02d60e0 c02b6000 c02b7f04 c02b7ec8 7ec0: c001cbc0 c001c3e4 c02b7eec c02b7ed8 00000006 0000000a c02bf674 c02c458c 7ee0: 00000011 00000000 c02b7f7c c0004000 41129200 c02b0c80 c02b7f14 c02b7f08 7f00: c001cdd0 c001cb38 c02b7f34 c02b7f18 c000983c c001cd98 c0009a60 60000013 7f20: fefb0001 c02b7f7c c02b7f44 c02b7f38 c0008190 c0009810 c02b7f9c c02b7f48 7f40: c0008b64 c0008190 c02c2bf8 00000002 c02b7f90 60000013 c02b6000 c02d1504 7f60: c02baa88 c02baa80 c0004000 41129200 c02b0c80 c02b7f9c c02b7fa0 c02b7f90 7f80: c0009a54 c0009a60 60000013 ffffffff c02b7fbc c02b7fa0 c000a03c c0009a40 7fa0: c02b80b0 c02b19dc c02b19d8 c02baa80 c02b7fcc c02b7fc0 c02384e4 c0009fd4 7fc0: c02b7ff4 c02b7fd0 c029d924 c0238494 c029d49c 00000000 00000000 c02b19dc 7fe0: c0007175 c02b803c 00000000 c02b7ff8 c000803c c029d700 00000000 00000000

Backtrace:
[<c012b43c>] (ep93xx_dma_tasklet+0x0/0x164) from [<c001c49c>] (tasklet_action+0x

c8/0xdc)
[<c001c3d4>] (tasklet_action+0x0/0xdc) from [<c001cbc0>] (__do_softirq+0x98/0x15
4)
r7:c02b6000 r6:c02d60e0 r5:00000001 r4:00000018
[<c001cb28>] (__do_softirq+0x0/0x154) from [<c001cdd0>] (irq_exit+0x48/0x50) [<c001cd88>] (irq_exit+0x0/0x50) from [<c000983c>] (handle_IRQ+0x3c/0x8c) [<c0009800>] (handle_IRQ+0x0/0x8c) from [<c0008190>] (asm_do_IRQ+0x10/0x14)
r7:c02b7f7c r6:fefb0001 r5:60000013 r4:c0009a60
[<c0008180>] (asm_do_IRQ+0x0/0x14) from [<c0008b64>] (__irq_svc+0x24/0xc0)

Exception stack(0xc02b7f48 to 0xc02b7f90)

7f40: c02c2bf8 00000002 c02b7f90 60000013 c02b6000 c02d1504
7f60: c02baa88 c02baa80 c0004000 41129200 c02b0c80 c02b7f9c c02b7fa0 c02b7f90 7f80: c0009a54 c0009a60 60000013 ffffffff
[<c0009a30>] (default_idle+0x0/0x34) from [<c000a03c>] (cpu_idle+0x78/0xb0) [<c0009fc4>] (cpu_idle+0x0/0xb0) from [<c02384e4>] (rest_init+0x60/0x78)
r7:c02baa80 r6:c02b19d8 r5:c02b19dc r4:c02b80b0
[<c0238484>] (rest_init+0x0/0x78) from [<c029d924>] (start_kernel+0x234/0x278) [<c029d6f0>] (start_kernel+0x0/0x278) from [<c000803c>] (0xc000803c)
r5:c02b803c r4:c0007175

Code: 42555300 54535953 643d4d45 65766972 (53007372)
---[ end trace a494979f60859f42 ]---
Kernel panic - not syncing: Fatal exception in interrupt

Rebooting in 2 seconds..

I'm trying to call dmaengine_terminate_all from function assigned as libata .bmdma_stop. Maybe this is incorrect, and this bug report is invalid...

Regards,
Rafal Prylowski.

#8 lore raw

Re: [PATCH v2 1/5] dmaengine: add ep93xx DMA support

Sorry for delay. I've been busy with other things.

Quoted 52 lines · Rafal Prylowski

sd 0:0:0:0: [sda] 625142448 512-byte logical blocks: (320 GB/298 GiB) sd 0:0:0:0: [sda] Write Protect is off
sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO
or FUA

Internal error: Oops - undefined instruction: 0 [#1]
CPU: 0    Not tainted  (3.2.0-rc1EP-1+ #1008)
PC is at 0xc184c868
LR is at ep93xx_dma_tasklet+0xec/0x164
pc : [<c184c868>]    lr : [<c012b528>]    psr: 00000013

sp : c02b7e70 ip : ffffffff fp : c02b7ea4
r10: 00000100 r9 : 80000013 r8 : c02b7e50
r7 : c02b7e70 r6 : c02b7ea4 r5 : 000000a4 r4 : c02b7e70 r3 : c02b751d r2 : 8ae34598 r1 : c184c6e0 r0 : c02b7ea4
Flags: nzcv IRQs on FIQs on Mode SVC_32 ISA ARM Segment kernel
Control: c000717f Table: c0004000 DAC: 00000017 Process swapper (pid: 0, stack limit = 0xc02b6270)

Stack: (0xc02b7e70 to 0xc02b8000)

7e60: c02b7ea4 c02b7e70 c0008b64 c02bd5c4
7e80: c02d60e0 00000000 00000000 c02bd44c c02d60e0 00000100 c02b7ec4 c02b7ea8 7ea0: c001c49c c012b44c 00000018 00000001 c02d60e0 c02b6000 c02b7f04 c02b7ec8 7ec0: c001cbc0 c001c3e4 c02b7eec c02b7ed8 00000006 0000000a c02bf674 c02c458c 7ee0: 00000011 00000000 c02b7f7c c0004000 41129200 c02b0c80 c02b7f14 c02b7f08 7f00: c001cdd0 c001cb38 c02b7f34 c02b7f18 c000983c c001cd98 c0009a60 60000013 7f20: fefb0001 c02b7f7c c02b7f44 c02b7f38 c0008190 c0009810 c02b7f9c c02b7f48 7f40: c0008b64 c0008190 c02c2bf8 00000002 c02b7f90 60000013 c02b6000 c02d1504 7f60: c02baa88 c02baa80 c0004000 41129200 c02b0c80 c02b7f9c c02b7fa0 c02b7f90 7f80: c0009a54 c0009a60 60000013 ffffffff c02b7fbc c02b7fa0 c000a03c c0009a40 7fa0: c02b80b0 c02b19dc c02b19d8 c02baa80 c02b7fcc c02b7fc0 c02384e4 c0009fd4 7fc0: c02b7ff4 c02b7fd0 c029d924 c0238494 c029d49c 00000000 00000000 c02b19dc 7fe0: c0007175 c02b803c 00000000 c02b7ff8 c000803c c029d700 00000000 00000000

Backtrace:
[<c012b43c>] (ep93xx_dma_tasklet+0x0/0x164) from [<c001c49c>] (tasklet_action+0x

c8/0xdc)
[<c001c3d4>] (tasklet_action+0x0/0xdc) from [<c001cbc0>] (__do_softirq+0x98/0x15
4)
r7:c02b6000 r6:c02d60e0 r5:00000001 r4:00000018
[<c001cb28>] (__do_softirq+0x0/0x154) from [<c001cdd0>] (irq_exit+0x48/0x50) [<c001cd88>] (irq_exit+0x0/0x50) from [<c000983c>] (handle_IRQ+0x3c/0x8c) [<c0009800>] (handle_IRQ+0x0/0x8c) from [<c0008190>] (asm_do_IRQ+0x10/0x14)
r7:c02b7f7c r6:fefb0001 r5:60000013 r4:c0009a60
[<c0008180>] (asm_do_IRQ+0x0/0x14) from [<c0008b64>] (__irq_svc+0x24/0xc0)

Exception stack(0xc02b7f48 to 0xc02b7f90)

7f40: c02c2bf8 00000002 c02b7f90 60000013 c02b6000 c02d1504
7f60: c02baa88 c02baa80 c0004000 41129200 c02b0c80 c02b7f9c c02b7fa0 c02b7f90 7f80: c0009a54 c0009a60 60000013 ffffffff
[<c0009a30>] (default_idle+0x0/0x34) from [<c000a03c>] (cpu_idle+0x78/0xb0) [<c0009fc4>] (cpu_idle+0x0/0xb0) from [<c02384e4>] (rest_init+0x60/0x78)
r7:c02baa80 r6:c02b19d8 r5:c02b19dc r4:c02b80b0
[<c0238484>] (rest_init+0x0/0x78) from [<c029d924>] (start_kernel+0x234/0x278) [<c029d6f0>] (start_kernel+0x0/0x278) from [<c000803c>] (0xc000803c)
r5:c02b803c r4:c0007175

Quoted 2 lines
Code: 42555300 54535953 643d4d45 65766972 (53007372)
---[ end trace a494979f60859f42 ]---

It looks like following scenario happened:

1. DMA interrupt is asserted

2. Interrupt is handled by ep93xx_dma_interrupt()

3. It schedules the ep93xx_dma_tasklet() but for some reason the tasklet is not immediately run when the interrupt handler returns.

4. Your driver calls dma_terminate_all() making the active list empty and disabling the channel & interrupt.

5. ep93xx_dma_tasklet() is run and since the list is empty, it gets pointer to some garbage which then OOPses as it tries to execute ->complete() which points to memory containing:

Code: 42555300 54535953 643d4d45 65766972 (53007372)

translated to ascii:

\0SUBSYSTEM=drivers\0S

probably the memory was re-used by some uevent.

I wasn't able to reproduce this but can you try if following patch helps? I'm not sure if it is correct but at least we get more information about the problem.

drivers/dma/ep93xx_dma.c +1 -0
index 6181811..5b717da 100644
@@ -1106,6 +1106,7 @@ static int ep93xx_dma_terminate_all(struct ep93xx_dma_chan *edmac)
 	spin_lock_irqsave(&edmac->lock, flags);
 	/* First we disable and flush the DMA channel */
 	edmac->edma->hw_shutdown(edmac);
+	tasklet_kill(&edmac->tasklet);
 	clear_bit(EP93XX_DMA_IS_CYCLIC, &edmac->flags);
 	list_splice_init(&edmac->active, &list);
 	list_splice_init(&edmac->queue, &list);
#9 lore raw

Re: [PATCH v2 1/5] dmaengine: add ep93xx DMA support

Hello.

Quoted 10 lines

I wasn't able to reproduce this but can you try if following patch helps? I'm not sure if it is correct but at least we get more information about the problem.

drivers/dma/ep93xx_dma.c +0 -0
index 6181811..5b717da 100644

drivers/dma/ep93xx_dma.c static int ep93xx_dma_terminate_all(struct ep93xx_dma_chan *edmac) · line 1112

Quoted 7 lines
drivers/dma/ep93xx_dma.c +1 -0
@@ -1106,6 +1106,7 @@ static int ep93xx_dma_terminate_all(struct ep93xx_dma_chan *edmac)
 	spin_lock_irqsave(&edmac->lock, flags);
 	/* First we disable and flush the DMA channel */
 	edmac->edma->hw_shutdown(edmac);
+	tasklet_kill(&edmac->tasklet);
 	clear_bit(EP93XX_DMA_IS_CYCLIC, &edmac->flags);
 	list_splice_init(&edmac->active, &list);
 	list_splice_init(&edmac->queue, &list);

It doesn't help:

Linux version 3.2.0-rc2EP-1+ (prylowski at server) (gcc version 4.4.2 (GCC) ) #1015
Mon Nov 21 08:30:57 CET 2011
CPU: ARM920T [41129200] revision 0 (ARMv4T), cr=c0007177
CPU: VIVT data cache, VIVT instruction cache
Machine: Metasoft FonTel EP Board
Memory policy: ECC disabled, Data cache writeback
Built 1 zonelists in Zone order, mobility grouping on. Total pages: 8128 Kernel command line: mtdparts=physmap-flash.0:128K(uboot),1152K(kernel),15104K(r ootfs) root=/dev/mtdblock2 rootfstype=jffs2 console=ttyAM0 init=/sbin/init early printk lpj=496128 panic=2
PID hash table entries: 128 (order: -3, 512 bytes)
Dentry cache hash table entries: 4096 (order: 2, 16384 bytes) Inode-cache hash table entries: 2048 (order: 1, 8192 bytes)
Memory: 32MB = 32MB total
Memory: 27452k/27452k available, 5316k reserved, 0K highmem
Virtual kernel memory layout:

    vector  : 0xffff0000 - 0xffff1000   (   4 kB)
    fixmap  : 0xfff00000 - 0xfffe0000   ( 896 kB)
    vmalloc : 0xc2800000 - 0xfe800000   ( 960 MB)
    lowmem  : 0xc0000000 - 0xc2000000   (  32 MB)
    modules : 0xbf000000 - 0xc0000000   (  16 MB)
      .text : 0xc0008000 - 0xc029d000   (2644 kB)
      .init : 0xc029d000 - 0xc02b6000   ( 100 kB)
      .data : 0xc02b6000 - 0xc02d1440   ( 110 kB)
       .bss : 0xc02d1464 - 0xc02df51c   (  57 kB)

SLUB: Genslabs=13, HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1 NR_IRQS:120
VIC @fefb0000: id 0x00041190, vendor 0x41
VIC @fefc0000: id 0x00041190, vendor 0x41
Console: colour dummy device 80x30
Calibrating delay loop (skipped) preset value.. 99.22 BogoMIPS (lpj=496128)
pid_max: default: 32768 minimum: 301
Mount-cache hash table entries: 512
CPU: Testing write buffer coherency: ok
NET: Registered protocol family 16
ep93xx clock: PLL1 running at 400 MHz, PLL2 at 192 MHz
ep93xx clock: FCLK 200 MHz, HCLK 100 MHz, PCLK 50 MHz
bio: create slab <bio-0> at 0
ep93xx-dma ep93xx-dma-m2p: EP93xx M2P DMA ready
ep93xx-dma ep93xx-dma-m2m: EP93xx M2M DMA ready
SCSI subsystem initialized
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
i2c-gpio i2c-gpio.0: using pins 49 (SDA) and 48 (SCL)
NET: Registered protocol family 2
IP route cache hash table entries: 1024 (order: 0, 4096 bytes)
TCP established hash table entries: 1024 (order: 1, 8192 bytes)
TCP bind hash table entries: 1024 (order: 0, 4096 bytes)
TCP: Hash tables configured (established 1024 bind 1024)
TCP reno registered
UDP hash table entries: 256 (order: 0, 4096 bytes)
UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
NET: Registered protocol family 1
JFFS2 version 2.2. (NAND) ?? 2001-2006 Red Hat, Inc.
msgmni has been set to 53
io scheduler noop registered
io scheduler deadline registered (default)
Serial: AMBA driver
apb:uart1: ttyAM0 at MMIO 0x808c0000 (irq = 52) is a AMBA
console [ttyAM0] enabled
apb:uart2: ttyAM1 at MMIO 0x808d0000 (irq = 54) is a AMBA apb:uart3: ttyAM2 at MMIO 0x808e0000 (irq = 55) is a AMBA fontel-pri fontel-pri: FonTel PRI initialized correctly.
ep93xx-ide ep93xx-ide: version 0.5
scsi0 : ep93xx-ide
ata1: PATA max UDMA/66 irq 40
physmap platform flash device: 01000000 at 60000000 physmap-flash.0: Found 1 x16 devices at 0x0 in 16-bit bank. Manufacturer ID 0x00 0001 Chip ID 0x002101
Amd/Fujitsu Extended Query Table at 0x0040
Amd/Fujitsu Extended Query version 1.3.
number of CFI chips: 1
3 cmdlinepart partitions found on MTD device physmap-flash.0 Creating 3 MTD partitions on "physmap-flash.0":
0x000000000000-0x000000020000 : "uboot" 0x000000020000-0x000000140000 : "kernel" 0x000000140000-0x000001000000 : "rootfs"
ep93xx-spi ep93xx-spi.0: EP93xx SPI Controller at 0x808a0000 irq 53 ep93xx-eth version 0.1 loading
eth0: ep93xx on-chip ethernet, IRQ 39, aa:42:14:07:63:9d
ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
ep93xx-ohci ep93xx-ohci: EP93xx OHCI
ep93xx-ohci ep93xx-ohci: new USB bus registered, assigned bus number 1 ep93xx-ohci ep93xx-ohci: irq 56, io mem 0x80020000
ata1.00: HPA detected: current 234439535, native 234441648
ata1.00: ATA-7: ST9120822AS, 3.ALC, max UDMA/133
ata1.00: 234439535 sectors, multi 0: LBA48
hub 1-0:1.0: USB hub found
hub 1-0:1.0: 3 ports detected
Initializing USB Mass Storage driver...
usbcore: registered new interface driver usb-storage
USB Mass Storage support registered.
ata1.00: configured for UDMA/66
scsi 0:0:0:0: Direct-Access ATA ST9120822AS 3.AL PQ: 0 ANSI: 5
usbcore: registered new interface driver fontel
sd 0:0:0:0: [sda] 234439535 512-byte logical blocks: (120 GB/111 GiB) rtc-ds1307 0-0068: rtc core: registered ds1307 as rtc0
rtc-ds1307 0-0068: 56 bytes nvram
sd 0:0:0:0: [sda] Write Protect is off
sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO
or FUA
ep93xx-rtc ep93xx-rtc: rtc core: registered ep93xx-rtc as rtc1 Software Watchdog Timer: 0.07 initialized. soft_noboot=0 soft_margin=60 sec soft _panic=0 (nowayout= 0)
TCP cubic registered
NET: Registered protocol family 17
NET: Registered protocol family 15
ep93xx-rtc ep93xx-rtc: setting system clock to 1970-01-01 00:00:07 UTC (7) Attempt to kill tasklet from interrupt

Unable to handle kernel NULL pointer dereference at virtual address 00000000
pgd = c0004000
[00000000] *pgd=00000000
Internal error: Oops: 80000005 [#1]
CPU: 0    Not tainted  (3.2.0-rc2EP-1+ #1015)
PC is at 0x0
LR is at sys_sched_yield+0x38/0x48
pc : [<00000000>]    lr : [<c0015030>]    psr: 20000093

sp : c02b7ce8 ip : c02b7cf8 fp : c02b7cf4
r10: c1918000 r9 : c19180a4 r8 : 00002118
r7 : 00000004 r6 : c02b7d20 r5 : c184d6bc r4 : c184d6b8 r3 : c023e458 r2 : c02b7ce8 r1 : 00000001 r0 : c02bcff0
Flags: nzCv IRQs off FIQs on Mode SVC_32 ISA ARM Segment kernel
Control: c000717f Table: c0004000 DAC: 00000017
Process swapper (pid: 0, stack limit = 0xc02b6270)

Stack: (0xc02b7ce8 to 0xc02b8000)

7ce0: c02b7d04 c02b7cf8 c023bdcc c0015008 c02b7d1c c02b7d08
7d00: c001ca04 c023bdb4 60000093 c184d680 c02b7d44 c02b7d20 c012ac8c c001c9d8 7d20: c02b7d20 c02b7d20 c02b7d44 c1914070 c19180a4 c2860000 c02b7d64 c02b7d48 7d40: c0177c50 c012ac54 c19180a4 c1918000 00000004 00000004 c02b7d8c c02b7d68 7d60: c0176a64 c0177c20 00000000 c1914190 00000000 00000001 0000000b c19180a4 7d80: c02b7dd4 c02b7d90 c0176cc0 c01769c4 00000001 40000093 00000000 00000000 7da0: c1914190 00000000 c1822000 c1912a80 00000028 00000000 00000000 00000028 7dc0: c02d8148 c02c0084 c02b7e0c c02b7dd8 c00426d0 c0176ae0 c02b7dfc c02b7de8 7de0: c0035628 c02c0084 00000028 c02b7f48 c02b7eb4 c02bd44c c02d60e0 c02b0c90 7e00: c02b7e24 c02b7e10 c004285c c004268c c02c0084 00000028 c02b7e3c c02b7e28 7e20: c0045178 c004283c c02c4578 00000028 c02b7e4c c02b7e40 c0042254 c00450fc 7e40: c02b7e6c c02b7e50 c0009838 c0042228 c001cb80 20000013 fefc0001 c02b7eb4 7e60: c02b7e7c c02b7e70 c0008190 c0009810 c02b7f04 c02b7e80 c0008b64 c0008190 7e80: 00000000 00000000 00000000 20000013 00000040 00000040 c02d60e0 c02b6000 7ea0: c02bd44c c02d60e0 c02b0c90 c02b7f04 c02b7f08 c02b7ec8 c001cdd0 c001cb80 7ec0: 20000013 ffffffff c02b7eec c02b7ed8 c004496c 0000000a c02bf674 c02c4578 7ee0: 00000011 00000000 c02b7f7c c0004000 41129200 c02b0c90 c02b7f14 c02b7f08 7f00: c001cdd0 c001cb38 c02b7f34 c02b7f18 c000983c c001cd98 c0009a60 60000013 7f20: fefb0001 c02b7f7c c02b7f44 c02b7f38 c0008190 c0009810 c02b7f9c c02b7f48 7f40: c0008b64 c0008190 c02c2bf8 00000002 c02b7f90 60000013 c02b6000 c02d1504 7f60: c02baa88 c02baa80 c0004000 41129200 c02b0c90 c02b7f9c c02b7fa0 c02b7f90 7f80: c0009a54 c0009a60 60000013 ffffffff c02b7fbc c02b7fa0 c000a03c c0009a40 7fa0: c02b80b0 c02b19ec c02b19e8 c02baa80 c02b7fcc c02b7fc0 c02384b4 c0009fd4 7fc0: c02b7ff4 c02b7fd0 c029d924 c0238464 c029d49c 00000000 00000000 c02b19ec 7fe0: c0007175 c02b803c 00000000 c02b7ff8 c000803c c029d700 00000000 00000000

Backtrace:
[<c0014ff8>] (sys_sched_yield+0x0/0x48) from [<c023bdcc>] (yield+0x28/0x2c)
[<c023bda4>] (yield+0x0/0x2c) from [<c001ca04>] (tasklet_kill+0x3c/0x9c)
[<c001c9c8>] (tasklet_kill+0x0/0x9c) from [<c012ac8c>] (ep93xx_dma_control+0x48/
0x1c0)
 r5:c184d680 r4:60000093
[<c012ac44>] (ep93xx_dma_control+0x0/0x1c0) from [<c0177c50>] (ep93xx_pata_dma_s
top+0x40/0xb8)
 r6:c2860000 r5:c19180a4 r4:c1914070
[<c0177c10>] (ep93xx_pata_dma_stop+0x0/0xb8) from [<c0176a64>] (ata_bmdma_port_i
ntr+0xb0/0x11c)
 r7:00000004 r6:00000004 r5:c1918000 r4:c19180a4
[<c01769b4>] (ata_bmdma_port_intr+0x0/0x11c) from [<c0176cc0>] (ata_bmdma_interr
upt+0x1f0/0x274)
 r9:c19180a4 r8:0000000b r7:00000001 r6:00000000 r5:c1914190
r4:00000000
[<c0176ad0>] (ata_bmdma_interrupt+0x0/0x274) from [<c00426d0>] (handle_irq_event
_percpu+0x54/0x1b0)
[<c004267c>] (handle_irq_event_percpu+0x0/0x1b0) from [<c004285c>] (handle_irq_e
vent+0x30/0x40)
[<c004282c>] (handle_irq_event+0x0/0x40) from [<c0045178>] (handle_level_irq+0x8

c/0xe8)
r5:00000028 r4:c02c0084
[<c00450ec>] (handle_level_irq+0x0/0xe8) from [<c0042254>] (generic_handle_irq+0 x3c/0x48)
r5:00000028 r4:c02c4578
[<c0042218>] (generic_handle_irq+0x0/0x48) from [<c0009838>] (handle_IRQ+0x38/0x 8c)
[<c0009800>] (handle_IRQ+0x0/0x8c) from [<c0008190>] (asm_do_IRQ+0x10/0x14)
r7:c02b7eb4 r6:fefc0001 r5:20000013 r4:c001cb80
[<c0008180>] (asm_do_IRQ+0x0/0x14) from [<c0008b64>] (__irq_svc+0x24/0xc0)

Exception stack(0xc02b7e80 to 0xc02b7ec8)

7e80: 00000000 00000000 00000000 20000013 00000040 00000040 c02d60e0 c02b6000 7ea0: c02bd44c c02d60e0 c02b0c90 c02b7f04 c02b7f08 c02b7ec8 c001cdd0 c001cb80 7ec0: 20000013 ffffffff
[<c001cb28>] (__do_softirq+0x0/0x154) from [<c001cdd0>] (irq_exit+0x48/0x50) [<c001cd88>] (irq_exit+0x0/0x50) from [<c000983c>] (handle_IRQ+0x3c/0x8c) [<c0009800>] (handle_IRQ+0x0/0x8c) from [<c0008190>] (asm_do_IRQ+0x10/0x14)
r7:c02b7f7c r6:fefb0001 r5:60000013 r4:c0009a60
[<c0008180>] (asm_do_IRQ+0x0/0x14) from [<c0008b64>] (__irq_svc+0x24/0xc0)

Exception stack(0xc02b7f48 to 0xc02b7f90)

7f40: c02c2bf8 00000002 c02b7f90 60000013 c02b6000 c02d1504
7f60: c02baa88 c02baa80 c0004000 41129200 c02b0c90 c02b7f9c c02b7fa0 c02b7f90 7f80: c0009a54 c0009a60 60000013 ffffffff
[<c0009a30>] (default_idle+0x0/0x34) from [<c000a03c>] (cpu_idle+0x78/0xb0) [<c0009fc4>] (cpu_idle+0x0/0xb0) from [<c02384b4>] (rest_init+0x60/0x78)
r7:c02baa80 r6:c02b19e8 r5:c02b19ec r4:c02b80b0
[<c0238454>] (rest_init+0x0/0x78) from [<c029d924>] (start_kernel+0x234/0x278) [<c029d6f0>] (start_kernel+0x0/0x278) from [<c000803c>] (0xc000803c)
r5:c02b803c r4:c0007175

Code: bad PC value
---[ end trace 3d4b7b18cc0879b4 ]---
Kernel panic - not syncing: Fatal exception in interrupt

Rebooting in 2 seconds..

I'm calling dma_terminate_all from interrupt. It seems that tasklet_kill is not allowed to be called from this context.

Thanks,
Rafa? Pry?owski.

#10 lore raw

Re: [PATCH v2 1/5] dmaengine: add ep93xx DMA support

Quoted 3 lines · Rafal Prylowski

I'm calling dma_terminate_all from interrupt. It seems that tasklet_kill is not allowed to be called from this context.

Ah, right.

One more try - this time we set a flag which prevents the tasktlet from referencing an empty list.

drivers/dma/ep93xx_dma.c +8 -0
index 6181811..f7244b3 100644
@@ -155,6 +155,8 @@ struct ep93xx_dma_chan {
 	unsigned long			flags;
 /* Channel is configured for cyclic transfers */
 #define EP93XX_DMA_IS_CYCLIC		0
+/* Channel is enabled */
+#define EP93xx_DMA_IS_RUNNING		1
 
 	int				buffer;
 	dma_cookie_t			last_completed;
@@ -673,6 +675,9 @@ static void ep93xx_dma_tasklet(unsigned long data)
 	void *callback_param;
 	LIST_HEAD(list);
 
+	if (!test_bit(EP93XX_DMA_IS_RUNNING, &edmac->flags))
+		return;
+
 	spin_lock_irq(&edmac->lock);
 	desc = ep93xx_dma_get_active(edmac);
 	if (desc->complete) {
@@ -758,6 +763,8 @@ static dma_cookie_t ep93xx_dma_tx_submit(struct dma_async_tx_descriptor *tx)
 	edmac->chan.cookie = cookie;
 	desc->txd.cookie = cookie;
 
+	set_bit(EP93XX_DMA_IS_RUNNING, &edmac->flags);
+
 	/*
 	 * If nothing is currently prosessed, we push this descriptor
 	 * directly to the hardware. Otherwise we put the descriptor
@@ -1106,6 +1113,7 @@ static int ep93xx_dma_terminate_all(struct ep93xx_dma_chan *edmac)
 	spin_lock_irqsave(&edmac->lock, flags);
 	/* First we disable and flush the DMA channel */
 	edmac->edma->hw_shutdown(edmac);
+	clear_bit(EP93XX_DMA_IS_RUNNING, &edmac->flags);
 	clear_bit(EP93XX_DMA_IS_CYCLIC, &edmac->flags);
 	list_splice_init(&edmac->active, &list);
 	list_splice_init(&edmac->queue, &list);
#11 lore raw

Re: [PATCH v2 1/5] dmaengine: add ep93xx DMA support

Quoted 9 lines · Mika Westerberg
Quoted 3 lines · Rafal Prylowski

I'm calling dma_terminate_all from interrupt. It seems that tasklet_kill is not allowed to be called from this context.

Ah, right.

One more try - this time we set a flag which prevents the tasktlet from referencing an empty list.

Rather than this why not actually check for list_empty and process only when it is not empty?
Also you should check the return of the ep93xx_dma_get_active() which should return NULL if it didn't find anything in active list

Quoted 46 lines
drivers/dma/ep93xx_dma.c +8 -0
index 6181811..f7244b3 100644
@@ -155,6 +155,8 @@ struct ep93xx_dma_chan {
 	unsigned long			flags;
 /* Channel is configured for cyclic transfers */
 #define EP93XX_DMA_IS_CYCLIC		0
+/* Channel is enabled */
+#define EP93xx_DMA_IS_RUNNING		1
 
 	int				buffer;
 	dma_cookie_t			last_completed;
@@ -673,6 +675,9 @@ static void ep93xx_dma_tasklet(unsigned long data)
 	void *callback_param;
 	LIST_HEAD(list);
 
+	if (!test_bit(EP93XX_DMA_IS_RUNNING, &edmac->flags))
+		return;
+
 	spin_lock_irq(&edmac->lock);
 	desc = ep93xx_dma_get_active(edmac);
 	if (desc->complete) {
@@ -758,6 +763,8 @@ static dma_cookie_t ep93xx_dma_tx_submit(struct dma_async_tx_descriptor *tx)
 	edmac->chan.cookie = cookie;
 	desc->txd.cookie = cookie;
 
+	set_bit(EP93XX_DMA_IS_RUNNING, &edmac->flags);
+
 	/*
 	 * If nothing is currently prosessed, we push this descriptor
 	 * directly to the hardware. Otherwise we put the descriptor
@@ -1106,6 +1113,7 @@ static int ep93xx_dma_terminate_all(struct ep93xx_dma_chan *edmac)
 	spin_lock_irqsave(&edmac->lock, flags);
 	/* First we disable and flush the DMA channel */
 	edmac->edma->hw_shutdown(edmac);
+	clear_bit(EP93XX_DMA_IS_RUNNING, &edmac->flags);
 	clear_bit(EP93XX_DMA_IS_CYCLIC, &edmac->flags);
 	list_splice_init(&edmac->active, &list);
 	list_splice_init(&edmac->queue, &list);

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

Signature · 1 line
~Vinod
#12 lore raw

Re: [PATCH v2 1/5] dmaengine: add ep93xx DMA support

Quoted 6 lines · Vinod Koul
Quoted 5 lines · Mika Westerberg
Quoted 3 lines · Rafal Prylowski

I'm calling dma_terminate_all from interrupt. It seems that tasklet_kill is not allowed to be called from this context.

Quoted 7 lines
Quoted 4 lines

Ah, right.

One more try - this time we set a flag which prevents the tasktlet from referencing an empty list.

Rather than this why not actually check for list_empty and process only when it is not empty?

I was thinking that it should be an error if the active list is empty when the tasklet is run.

Quoted 2 lines

Also you should check the return of the ep93xx_dma_get_active() which should return NULL if it didn't find anything in active list

Right - if the list is allowed to be empty.

I'll re-check the patch from Rafal. Maybe it's better to adapt with the fact that dma_terminate_all() can be called in any context any time and modify the driver accordingly (e.g like you say, return NULL if the list is empty handle it correctly).

#13 lore raw

Re: [PATCH v2 1/5] dmaengine: add ep93xx DMA support

Quoted 9 lines · Mika Westerberg
Quoted 8 lines · Vinod Koul
Quoted 7 lines · Mika Westerberg
Quoted 3 lines · Rafal Prylowski

I'm calling dma_terminate_all from interrupt. It seems that tasklet_kill is not allowed to be called from this context.

Ah, right.

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

One more try - this time we set a flag which prevents the tasktlet from referencing an empty list.

Rather than this why not actually check for list_empty and process only when it is not empty?

I was thinking that it should be an error if the active list is empty when the tasklet is run.

well where would you return the error from tasklet?

Quoted 10 lines
Quoted 3 lines

Also you should check the return of the ep93xx_dma_get_active() which should return NULL if it didn't find anything in active list

Right - if the list is allowed to be empty.

I'll re-check the patch from Rafal. Maybe it's better to adapt with the fact that dma_terminate_all() can be called in any context any time and modify the driver accordingly (e.g like you say, return NULL if the list is empty handle it correctly).

Yes dma_terminate_all() is allowed to be called by the driver in any context. It may wish to terminate at any point and this can potentially lead to race condition when you do actual hardware right to terminate just when hardware sent the interrupt. And your tasklet is scheduled after the list becomes empty.
So its better approach to check for list in tasklet and return of ep93xx_dma_get_active() for a valid descriptor

Signature · 1 line
~Vinod
#14 lore raw

Re: [PATCH v2 1/5] dmaengine: add ep93xx DMA support

In reply to Mika Westerberg
Quoted 42 lines
Quoted 2 lines

I'm calling dma_terminate_all from interrupt. It seems that tasklet_kill is not allowed to be called from this context.

Ah, right.

One more try - this time we set a flag which prevents the tasktlet from referencing an empty list.

drivers/dma/ep93xx_dma.c +7 -0
index 6181811..f7244b3 100644
@@ -155,6 +155,8 @@ struct ep93xx_dma_chan {
 	unsigned long			flags;
 /* Channel is configured for cyclic transfers */
 #define EP93XX_DMA_IS_CYCLIC		0
+/* Channel is enabled */
+#define EP93xx_DMA_IS_RUNNING		1
 
 	int				buffer;
 	dma_cookie_t			last_completed;
@@ -673,6 +675,9 @@ static void ep93xx_dma_tasklet(unsigned long data)
 	void *callback_param;
 	LIST_HEAD(list);
 
+	if (!test_bit(EP93XX_DMA_IS_RUNNING, &edmac->flags))
+		return;
+
 	spin_lock_irq(&edmac->lock);
 	desc = ep93xx_dma_get_active(edmac);
 	if (desc->complete) {
@@ -758,6 +763,8 @@ static dma_cookie_t ep93xx_dma_tx_submit(struct dma_async_tx_descriptor *tx)
 	edmac->chan.cookie = cookie;
 	desc->txd.cookie = cookie;
 
+	set_bit(EP93XX_DMA_IS_RUNNING, &edmac->flags);
+
 	/*
 	 * If nothing is currently prosessed, we push this descriptor
 	 * directly to the hardware. Otherwise we put the descriptor

drivers/dma/ep93xx_dma.c static int ep93xx_dma_terminate_all(struct ep93xx_dma_chan *edmac) · line 1119

Quoted 7 lines
drivers/dma/ep93xx_dma.c +1 -0
@@ -1106,6 +1113,7 @@ static int ep93xx_dma_terminate_all(struct ep93xx_dma_chan *edmac)
 	spin_lock_irqsave(&edmac->lock, flags);
 	/* First we disable and flush the DMA channel */
 	edmac->edma->hw_shutdown(edmac);
+	clear_bit(EP93XX_DMA_IS_RUNNING, &edmac->flags);
 	clear_bit(EP93XX_DMA_IS_CYCLIC, &edmac->flags);
 	list_splice_init(&edmac->active, &list);
 	list_splice_init(&edmac->queue, &list);

This patch works partially for me. Drive is detected correctly, I can do simple test with hdparm, mount partitions, create file with 'touch' command, but when trying to fill partition with data I get:

# dd if=/dev/zero of=/mnt/b/zero4 bs=4M
Internal error: Oops - undefined instruction: 0 [#1]
CPU: 0    Not tainted  (3.2.0-rc2EP-1+ #1017)
PC is at 0xc1862868
LR is at ep93xx_dma_tasklet+0xc4/0x174
pc : [<c1862868>]    lr : [<c012b498>]    psr: 00000013
sp : c10c3b60  ip : ffffffff  fp : c10c3b94
r10: 00000100  r9 : 80000013  r8 : c10c3b40
r7 : c10c3b60  r6 : c10c3b94  r5 : 00000094  r4 : c10c3b60
r3 : c10c320d  r2 : a0e96520  r1 : c1862758  r0 : c10c3b94
Flags: nzcv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment user
Control: c000717f  Table: c1240000  DAC: 00000015
Process dd (pid: 619, stack limit = 0xc10c2270)
Stack: (0xc10c3b60 to 0xc10c4000)
3b60: c10c3b94 c10c3b60 00000001 c02bd5c4 c02d60e0 00000000 00000000 c02bd44c
3b80: c02d60e0 00000100 c10c3bb4 c10c3b98 c001c49c c012b3e4 00000018 00000001
3ba0: c02d60e0 c10c2000 c10c3bf4 c10c3bb8 c001cbc0 c001c3e4 c10c3bdc c10c3bc8
3bc0: 00000006 0000000a c02bf6e4 c02c4578 00000012 00000000 c10c3c6c 00000000
3be0: 00000000 00000000 c10c3c04 c10c3bf8 c001cdd0 c001cb38 c10c3c24 c10c3c08
3c00: c000983c c001cd98 c00e1160 80000013 fefb0001 c10c3c6c c10c3c34 c10c3c28
3c20: c0008190 c0009810 c10c3ccc c10c3c38 c0008b64 c0008190 c1a44058 00000003
3c40: ffffb58e ffffffc7 c156a000 c1a70060 c10c2000 c1a44000 00000000 00000000
3c60: 00000000 c10c3ccc c1a4404c c10c3c80 c0011a28 c00e1160 80000013 ffffffff
3c80: 00000000 00001000 c10c3cb4 c10c3c98 c00d9eac c00e0f88 c156a000 c1791250
3ca0: c156a000 00000000 c0242f4c c1a44600 03605000 00000000 00000000 00001000
3cc0: c10c3cec c10c3cd0 c00d9eac c00e0f88 c1791250 c02f9860 c156a000 03605000
3ce0: c10c3d2c c10c3cf0 c00d3d7c c00d9e94 00001000 00001000 c02f9860 c008df3c
3d00: c10c3d58 c0242d18 c10c2000 c1791308 00000000 c10c3d58 00001000 00204000
3d20: c10c3d9c c10c3d30 c0046f00 c00d3cbc 00001000 00001000 c02f9860 c008df3c
3d40: 00000000 00001000 c0242d18 c19e4000 03604000 00000000 c10c3f10 00000001
3d60: 00204000 001fc000 c008df3c c02f9860 00000073 c10c3ec8 c10c2000 c19e4000
3d80: 000001fe 00000000 c10c3f10 c1791308 c10c3e2c c10c3da0 c0049028 c0046e10
3da0: 03400000 00000000 c10c3ec8 00400000 00000000 c10c3dd0 c10c3dc4 00400000
3dc0: 03800000 00000000 00000001 c10c3ec8 c10c3e90 c02d8148 03400000 00000000
3de0: c10c3dec 00000001 c00443e8 00000001 c02d60e0 00000008 c02bf6e4 00400000
3e00: 00000000 c10c3e40 c17912ac c19e4000 03400000 c10c3e90 c10c3f10 00000001
3e20: c10c3e84 c10c3e30 c00492a4 c0048cf0 c10c3e3c c0045198 c0044954 00000000
3e40: 91827364 c10c3e44 c10c3e44 c10c3e4c c10c3e4c 00000000 c10c3e64 c10c3e90
3e60: c19e4000 c10c3f10 fffffdee c10c3f78 03400000 00000000 c10c3f44 c10c3e88
3e80: c0079114 c0049234 03400000 00000000 c0008190 40b90a78 00000000 00000001
3ea0: ffffffff c19e4000 00000000 00000000 00000000 00000000 c1aea000 c10c2000
3ec0: 00000000 00000000 03400000 00000000 c10c3f0c c10c3ee0 00400000 c0034478
3ee0: 00400000 c1a03658 00001000 40b95008 00001000 003ff000 c10c2000 c1818780
3f00: c19e4288 00000001 c01197e8 00000000 40796008 00400000 c01474b0 c19e4000
3f20: 00400000 40796008 c10c3f78 c0009124 c10c2000 00000000 c10c3f74 c10c3f48
3f40: c0079c7c c0079064 00000000 00000000 c0009124 c19e4000 03400000 00000000
3f60: 00000004 c0009124 c10c3fa4 c10c3f78 c0079df4 c0079bd0 03400000 00000000
3f80: 00000004 00000000 c10c2000 00400000 40796008 4004f7e0 00000000 c10c3fa8
3fa0: c0008fa0 c0079db8 00400000 40796008 00000001 40796008 00400000 000abfc4
3fc0: 00400000 40796008 4004f7e0 00000004 40796008 40796008 bedb5f34 00000000
3fe0: 00000001 bedb5ba0 0000ef78 40180dcc 60000010 00000001 00000000 00000000
Backtrace:
[<c012b3d4>] (ep93xx_dma_tasklet+0x0/0x174) from [<c001c49c>] (tasklet_action+0x
c8/0xdc)
[<c001c3d4>] (tasklet_action+0x0/0xdc) from [<c001cbc0>] (__do_softirq+0x98/0x15
4)
 r7:c10c2000 r6:c02d60e0 r5:00000001 r4:00000018
[<c001cb28>] (__do_softirq+0x0/0x154) from [<c001cdd0>] (irq_exit+0x48/0x50)
[<c001cd88>] (irq_exit+0x0/0x50) from [<c000983c>] (handle_IRQ+0x3c/0x8c)
[<c0009800>] (handle_IRQ+0x0/0x8c) from [<c0008190>] (asm_do_IRQ+0x10/0x14)
 r7:c10c3c6c r6:fefb0001 r5:80000013 r4:c00e1160
[<c0008180>] (asm_do_IRQ+0x0/0x14) from [<c0008b64>] (__irq_svc+0x24/0xc0)
Exception stack(0xc10c3c38 to 0xc10c3c80)
3c20:                                                       c1a44058 00000003
3c40: ffffb58e ffffffc7 c156a000 c1a70060 c10c2000 c1a44000 00000000 00000000
3c60: 00000000 c10c3ccc c1a4404c c10c3c80 c0011a28 c00e1160 80000013 ffffffff
[<c00e0f78>] (journal_stop+0x0/0x2bc) from [<c00d9eac>] (__ext3_journal_stop+0x2
8/0x58)
[<c00d9e84>] (__ext3_journal_stop+0x0/0x58) from [<c00d3d7c>] (ext3_writeback_wr
ite_end+0xd0/0x174)
 r7:03605000 r6:c156a000 r5:c02f9860 r4:c1791250
[<c00d3cac>] (ext3_writeback_write_end+0x0/0x174) from [<c0046f00>] (generic_fil
e_buffered_write+0x100/0x25c)
[<c0046e00>] (generic_file_buffered_write+0x0/0x25c) from [<c0049028>] (__generi
c_file_aio_write+0x348/0x544)
[<c0048ce0>] (__generic_file_aio_write+0x0/0x544) from [<c00492a4>] (generic_fil
e_aio_write+0x80/0xe8)
[<c0049224>] (generic_file_aio_write+0x0/0xe8) from [<c0079114>] (do_sync_write+
0xc0/0xf8)
[<c0079054>] (do_sync_write+0x0/0xf8) from [<c0079c7c>] (vfs_write+0xbc/0x150)
[<c0079bc0>] (vfs_write+0x0/0x150) from [<c0079df4>] (sys_write+0x4c/0x84)
 r8:c0009124 r7:00000004 r6:00000000 r5:03400000 r4:c19e4000
[<c0079da8>] (sys_write+0x0/0x84) from [<c0008fa0>] (ret_fast_syscall+0x0/0x2c)
 r6:4004f7e0 r5:40796008 r4:00400000
Code: 42555300 54535953 643d4d45 65766972 (53007372)
---[ end trace 8f90267a5628d8bf ]---
Kernel panic - not syncing: Fatal exception in interrupt

I don't get this exception when using my patch, posted in first email.

#15 lore raw

Re: [PATCH v2 1/5] dmaengine: add ep93xx DMA support

Quoted 7 lines · Rafal Prylowski

This patch works partially for me. Drive is detected correctly, I can do simple test with hdparm, mount partitions, create file with 'touch' command, but when trying to fill partition with data I get:

# dd if=/dev/zero of=/mnt/b/zero4 bs=4M
Internal error: Oops - undefined instruction: 0 [#1]

Right. It still should call ep93xx_dma_advance_work(). Like the patch below.

Let me know if this works for you. Basically it's the patch from you except that we use a flag to indicate if the channel is running or not.

I would like to keep it this way (given that it solves the crash you are seeing, that is) to make sure that we can expect that the active list is never empty when the channel is operating.

drivers/dma/ep93xx_dma.c +15 -9
index 6181811..2670005 100644
@@ -155,6 +155,8 @@ struct ep93xx_dma_chan {
 	unsigned long			flags;
 /* Channel is configured for cyclic transfers */
 #define EP93XX_DMA_IS_CYCLIC		0
+/* Channel is enabled */
+#define EP93XX_DMA_IS_RUNNING		1
 
 	int				buffer;
 	dma_cookie_t			last_completed;
@@ -669,24 +671,25 @@ static void ep93xx_dma_tasklet(unsigned long data)
 {
 	struct ep93xx_dma_chan *edmac = (struct ep93xx_dma_chan *)data;
 	struct ep93xx_dma_desc *desc, *d;
-	dma_async_tx_callback callback;
-	void *callback_param;
+	dma_async_tx_callback callback = NULL;
+	void *callback_param = NULL;
 	LIST_HEAD(list);
 
 	spin_lock_irq(&edmac->lock);
-	desc = ep93xx_dma_get_active(edmac);
-	if (desc->complete) {
-		edmac->last_completed = desc->txd.cookie;
-		list_splice_init(&edmac->active, &list);
+	if (test_bit(EP93XX_DMA_IS_RUNNING, &edmac->flags)) {
+		desc = ep93xx_dma_get_active(edmac);
+		if (desc->complete) {
+			edmac->last_completed = desc->txd.cookie;
+			list_splice_init(&edmac->active, &list);
+		}
+		callback = desc->txd.callback;
+		callback_param = desc->txd.callback_param;
 	}
 	spin_unlock_irq(&edmac->lock);
 
 	/* Pick up the next descriptor from the queue */
 	ep93xx_dma_advance_work(edmac);
 
-	callback = desc->txd.callback;
-	callback_param = desc->txd.callback_param;
-
 	/* Now we can release all the chained descriptors */
 	list_for_each_entry_safe(desc, d, &list, node) {
 		/*
@@ -758,6 +761,8 @@ static dma_cookie_t ep93xx_dma_tx_submit(struct dma_async_tx_descriptor *tx)
 	edmac->chan.cookie = cookie;
 	desc->txd.cookie = cookie;
 
+	set_bit(EP93XX_DMA_IS_RUNNING, &edmac->flags);
+
 	/*
 	 * If nothing is currently prosessed, we push this descriptor
 	 * directly to the hardware. Otherwise we put the descriptor
@@ -1106,6 +1111,7 @@ static int ep93xx_dma_terminate_all(struct ep93xx_dma_chan *edmac)
 	spin_lock_irqsave(&edmac->lock, flags);
 	/* First we disable and flush the DMA channel */
 	edmac->edma->hw_shutdown(edmac);
+	clear_bit(EP93XX_DMA_IS_RUNNING, &edmac->flags);
 	clear_bit(EP93XX_DMA_IS_CYCLIC, &edmac->flags);
 	list_splice_init(&edmac->active, &list);
 	list_splice_init(&edmac->queue, &list);
#16 lore raw

Re: [PATCH v2 1/5] dmaengine: add ep93xx DMA support

Quoted 3 lines · Mika Westerberg

Let me know if this works for you. Basically it's the patch from you except that we use a flag to indicate if the channel is running or not.

It works correctly. All of my simple hdd tests completed without any problems. Thanks.

#17 lore raw

PATCH v2 2/5 ep93xx: add dmaengine platform code

In reply to Mika Westerberg

Add platform support code for the new EP93xx dmaengine driver.

---
 arch/arm/mach-ep93xx/Makefile |    2 +
 arch/arm/mach-ep93xx/dma.c    |  108 +++++++++++++++++++++++++++++++++++++++++
 2 files changed, 110 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/mach-ep93xx/dma.c
arch/arm/mach-ep93xx/Makefile +2 -0
index 33ee2c8..4920f7a 100644
@@ -6,6 +6,8 @@ obj-m			:=
 obj-n			:=
 obj-			:=
 
+obj-$(CONFIG_EP93XX_DMA)	+= dma.o
+
 obj-$(CONFIG_MACH_ADSSPHERE)	+= adssphere.o
 obj-$(CONFIG_MACH_EDB93XX)	+= edb93xx.o
 obj-$(CONFIG_MACH_GESBC9312)	+= gesbc9312.o
arch/arm/mach-ep93xx/dma.c new file +108 -0

108 lines not on this page · raw message

Signature · 1 line
1.7.4.4
#18 lore raw

PATCH v2 3/5 ASoC: ep93xx: convert to use the DMA engine API

In reply to Mika Westerberg

Now that we have the EP93xx DMA engine driver in place, we convert the ASoC drivers (I2S, AC97 and PCM) to take advantage of this new API. There are no functional changes.

---
 sound/soc/ep93xx/ep93xx-ac97.c |    4 +-
 sound/soc/ep93xx/ep93xx-i2s.c  |    4 +-
 sound/soc/ep93xx/ep93xx-pcm.c  |  137 ++++++++++++++++++++++-----------------
 3 files changed, 81 insertions(+), 64 deletions(-)
sound/soc/ep93xx/ep93xx-ac97.c +2 -2
index 104e95c..c7417c7 100644
@@ -106,12 +106,12 @@ static struct ep93xx_ac97_info *ep93xx_ac97_info;
 
 static struct ep93xx_pcm_dma_params ep93xx_ac97_pcm_out = {
 	.name		= "ac97-pcm-out",
-	.dma_port	= EP93XX_DMA_M2P_PORT_AAC1,
+	.dma_port	= EP93XX_DMA_AAC1,
 };
 
 static struct ep93xx_pcm_dma_params ep93xx_ac97_pcm_in = {
 	.name		= "ac97-pcm-in",
-	.dma_port	= EP93XX_DMA_M2P_PORT_AAC1,
+	.dma_port	= EP93XX_DMA_AAC1,
 };
 
 static inline unsigned ep93xx_ac97_read_reg(struct ep93xx_ac97_info *info,
sound/soc/ep93xx/ep93xx-i2s.c +2 -2
index 042f4e9..30df425 100644
@@ -70,11 +70,11 @@ struct ep93xx_i2s_info {
 struct ep93xx_pcm_dma_params ep93xx_i2s_dma_params[] = {
 	[SNDRV_PCM_STREAM_PLAYBACK] = {
 		.name		= "i2s-pcm-out",
-		.dma_port	= EP93XX_DMA_M2P_PORT_I2S1,
+		.dma_port	= EP93XX_DMA_I2S1,
 	},
 	[SNDRV_PCM_STREAM_CAPTURE] = {
 		.name		= "i2s-pcm-in",
-		.dma_port	= EP93XX_DMA_M2P_PORT_I2S1,
+		.dma_port	= EP93XX_DMA_I2S1,
 	},
 };
 
sound/soc/ep93xx/ep93xx-pcm.c +77 -60

211 lines not on this page · raw message

Signature · 1 line
1.7.4.4
#19 lore raw

PATCH v2 4/5 ep93xx: remove the old M2P DMA code

In reply to Mika Westerberg

Since we have converted all existing users of the old DMA API to use the DMA engine API the old code can be dropped.

---
 arch/arm/mach-ep93xx/Makefile           |    2 +-
 arch/arm/mach-ep93xx/dma-m2p.c          |  411 -------------------------------
 arch/arm/mach-ep93xx/include/mach/dma.h |  143 -----------
 3 files changed, 1 insertions(+), 555 deletions(-)
 delete mode 100644 arch/arm/mach-ep93xx/dma-m2p.c
arch/arm/mach-ep93xx/Makefile +1 -1
index 4920f7a..21e721a 100644
@@ -1,7 +1,7 @@
 #
 # Makefile for the linux kernel.
 #
-obj-y			:= core.o clock.o dma-m2p.o gpio.o
+obj-y			:= core.o clock.o gpio.o
 obj-m			:=
 obj-n			:=
 obj-			:=
arch/arm/mach-ep93xx/dma-m2p.c deleted +0 -411

411 lines not on this page · raw message

arch/arm/mach-ep93xx/include/mach/dma.h +0 -143

153 lines not on this page · raw message

Signature · 1 line
1.7.4.4
#20 lore raw

PATCH v2 5/5 spi/ep93xx: add DMA support

In reply to Mika Westerberg

This patch adds DMA support for the EP93xx SPI driver. By default the DMA is not enabled but it can be enabled by setting ep93xx_spi_info.use_dma to true in board configuration file.

Note that the SPI driver still uses PIO for small transfers (<= 8 bytes) for performance reasons.

---
 Documentation/spi/ep93xx_spi                   |   10 +
 arch/arm/mach-ep93xx/core.c                    |    6 +-
 arch/arm/mach-ep93xx/include/mach/ep93xx_spi.h |    2 +
 drivers/spi/ep93xx_spi.c                       |  303 +++++++++++++++++++++++-
 4 files changed, 308 insertions(+), 13 deletions(-)
Documentation/spi/ep93xx_spi +10 -0
index 6325f5b..d8eb01c 100644
@@ -88,6 +88,16 @@ static void __init ts72xx_init_machine(void)
 			    ARRAY_SIZE(ts72xx_spi_devices));
 }
 
+The driver can use DMA for the transfers also. In this case ts72xx_spi_info
+becomes:
+
+static struct ep93xx_spi_info ts72xx_spi_info = {
+	.num_chipselect	= ARRAY_SIZE(ts72xx_spi_devices),
+	.use_dma	= true;
+};
+
+Note that CONFIG_EP93XX_DMA should be enabled as well.
+
 Thanks to
 =========
 Martin Guy, H. Hartley Sweeten and others who helped me during development of
arch/arm/mach-ep93xx/core.c +5 -1
index 8207954..cc9f1d4 100644
@@ -488,11 +488,15 @@ static struct resource ep93xx_spi_resources[] = {
 	},
 };
 
+static u64 ep93xx_spi_dma_mask = DMA_BIT_MASK(32);
+
 static struct platform_device ep93xx_spi_device = {
 	.name		= "ep93xx-spi",
 	.id		= 0,
 	.dev		= {
-		.platform_data = &ep93xx_spi_master_data,
+		.platform_data		= &ep93xx_spi_master_data,
+		.coherent_dma_mask	= DMA_BIT_MASK(32),
+		.dma_mask		= &ep93xx_spi_dma_mask,
 	},
 	.num_resources	= ARRAY_SIZE(ep93xx_spi_resources),
 	.resource	= ep93xx_spi_resources,
arch/arm/mach-ep93xx/include/mach/ep93xx_spi.h +2 -0
index 0a37961..9bb63ac 100644
@@ -7,9 +7,11 @@ struct spi_device;
  * struct ep93xx_spi_info - EP93xx specific SPI descriptor
  * @num_chipselect: number of chip selects on this board, must be
  *                  at least one
+ * @use_dma: use DMA for the transfers
  */
 struct ep93xx_spi_info {
 	int	num_chipselect;
+	bool	use_dma;
 };
 
 /**
drivers/spi/ep93xx_spi.c +291 -12

403 lines not on this page · raw message

Signature · 1 line
1.7.4.4
Acked-by on v2 5/5
#21 lore raw

Re: [PATCH v2 5/5] spi/ep93xx: add DMA support

Quoted 10 lines · Mika Westerberg

This patch adds DMA support for the EP93xx SPI driver. By default the DMA is not enabled but it can be enabled by setting ep93xx_spi_info.use_dma to true in board configuration file.

Note that the SPI driver still uses PIO for small transfers (<= 8 bytes) for performance reasons.

Since this depends on the DMA patches, it can go in via the same tree.

g.

Quoted 489 lines
---
 Documentation/spi/ep93xx_spi                   |   10 +
 arch/arm/mach-ep93xx/core.c                    |    6 +-
 arch/arm/mach-ep93xx/include/mach/ep93xx_spi.h |    2 +
 drivers/spi/ep93xx_spi.c                       |  303 +++++++++++++++++++++++-
 4 files changed, 308 insertions(+), 13 deletions(-)
Documentation/spi/ep93xx_spi +10 -0
index 6325f5b..d8eb01c 100644
@@ -88,6 +88,16 @@ static void __init ts72xx_init_machine(void)
 			    ARRAY_SIZE(ts72xx_spi_devices));
 }
 
+The driver can use DMA for the transfers also. In this case ts72xx_spi_info
+becomes:
+
+static struct ep93xx_spi_info ts72xx_spi_info = {
+	.num_chipselect	= ARRAY_SIZE(ts72xx_spi_devices),
+	.use_dma	= true;
+};
+
+Note that CONFIG_EP93XX_DMA should be enabled as well.
+
 Thanks to
 =========
 Martin Guy, H. Hartley Sweeten and others who helped me during development of
arch/arm/mach-ep93xx/core.c +5 -1
index 8207954..cc9f1d4 100644
@@ -488,11 +488,15 @@ static struct resource ep93xx_spi_resources[] = {
 	},
 };
 
+static u64 ep93xx_spi_dma_mask = DMA_BIT_MASK(32);
+
 static struct platform_device ep93xx_spi_device = {
 	.name		= "ep93xx-spi",
 	.id		= 0,
 	.dev		= {
-		.platform_data = &ep93xx_spi_master_data,
+		.platform_data		= &ep93xx_spi_master_data,
+		.coherent_dma_mask	= DMA_BIT_MASK(32),
+		.dma_mask		= &ep93xx_spi_dma_mask,
 	},
 	.num_resources	= ARRAY_SIZE(ep93xx_spi_resources),
 	.resource	= ep93xx_spi_resources,
arch/arm/mach-ep93xx/include/mach/ep93xx_spi.h +2 -0
index 0a37961..9bb63ac 100644
@@ -7,9 +7,11 @@ struct spi_device;
  * struct ep93xx_spi_info - EP93xx specific SPI descriptor
  * @num_chipselect: number of chip selects on this board, must be
  *                  at least one
+ * @use_dma: use DMA for the transfers
  */
 struct ep93xx_spi_info {
 	int	num_chipselect;
+	bool	use_dma;
 };
 
 /**
drivers/spi/ep93xx_spi.c +291 -12
index d357007..1cf6454 100644
@@ -1,7 +1,7 @@
 /*
  * Driver for Cirrus Logic EP93xx SPI controller.
  *
- * Copyright (c) 2010 Mika Westerberg
+ * Copyright (C) 2010-2011 Mika Westerberg
  *
  * Explicit FIFO handling code was inspired by amba-pl022 driver.
  *
@@ -21,13 +21,16 @@
 #include <linux/err.h>
 #include <linux/delay.h>
 #include <linux/device.h>
+#include <linux/dmaengine.h>
 #include <linux/bitops.h>
 #include <linux/interrupt.h>
 #include <linux/platform_device.h>
 #include <linux/workqueue.h>
 #include <linux/sched.h>
+#include <linux/scatterlist.h>
 #include <linux/spi/spi.h>
 
+#include <mach/dma.h>
 #include <mach/ep93xx_spi.h>
 
 #define SSPCR0			0x0000
@@ -71,6 +74,7 @@
  * @pdev: pointer to platform device
  * @clk: clock for the controller
  * @regs_base: pointer to ioremap()'d registers
+ * @sspdr_phys: physical address of the SSPDR register
  * @irq: IRQ number used by the driver
  * @min_rate: minimum clock rate (in Hz) supported by the controller
  * @max_rate: maximum clock rate (in Hz) supported by the controller
@@ -84,6 +88,14 @@
  * @rx: current byte in transfer to receive
  * @fifo_level: how full is FIFO (%0..%SPI_FIFO_SIZE - %1). Receiving one
  *              frame decreases this level and sending one frame increases it.
+ * @dma_rx: RX DMA channel
+ * @dma_tx: TX DMA channel
+ * @dma_rx_data: RX parameters passed to the DMA engine
+ * @dma_tx_data: TX parameters passed to the DMA engine
+ * @rx_sgt: sg table for RX transfers
+ * @tx_sgt: sg table for TX transfers
+ * @zeropage: dummy page used as RX buffer when only TX buffer is passed in by
+ *            the client
  *
  * This structure holds EP93xx SPI controller specific information. When
  * @running is %true, driver accepts transfer requests from protocol drivers.
@@ -100,6 +112,7 @@ struct ep93xx_spi {
 	const struct platform_device	*pdev;
 	struct clk			*clk;
 	void __iomem			*regs_base;
+	unsigned long			sspdr_phys;
 	int				irq;
 	unsigned long			min_rate;
 	unsigned long			max_rate;
@@ -112,6 +125,13 @@ struct ep93xx_spi {
 	size_t				tx;
 	size_t				rx;
 	size_t				fifo_level;
+	struct dma_chan			*dma_rx;
+	struct dma_chan			*dma_tx;
+	struct ep93xx_dma_data		dma_rx_data;
+	struct ep93xx_dma_data		dma_tx_data;
+	struct sg_table			rx_sgt;
+	struct sg_table			tx_sgt;
+	void				*zeropage;
 };
 
 /**
@@ -496,14 +516,195 @@ static int ep93xx_spi_read_write(struct ep93xx_spi *espi)
 		espi->fifo_level++;
 	}
 
-	if (espi->rx == t->len) {
-		msg->actual_length += t->len;
+	if (espi->rx == t->len)
 		return 0;
-	}
 
 	return -EINPROGRESS;
 }
 
+static void ep93xx_spi_pio_transfer(struct ep93xx_spi *espi)
+{
+	/*
+	 * Now everything is set up for the current transfer. We prime the TX
+	 * FIFO, enable interrupts, and wait for the transfer to complete.
+	 */
+	if (ep93xx_spi_read_write(espi)) {
+		ep93xx_spi_enable_interrupts(espi);
+		wait_for_completion(&espi->wait);
+	}
+}
+
+/**
+ * ep93xx_spi_dma_prepare() - prepares a DMA transfer
+ * @espi: ep93xx SPI controller struct
+ * @dir: DMA transfer direction
+ *
+ * Function configures the DMA, maps the buffer and prepares the DMA
+ * descriptor. Returns a valid DMA descriptor in case of success and ERR_PTR
+ * in case of failure.
+ */
+static struct dma_async_tx_descriptor *
+ep93xx_spi_dma_prepare(struct ep93xx_spi *espi, enum dma_data_direction dir)
+{
+	struct spi_transfer *t = espi->current_msg->state;
+	struct dma_async_tx_descriptor *txd;
+	enum dma_slave_buswidth buswidth;
+	struct dma_slave_config conf;
+	struct scatterlist *sg;
+	struct sg_table *sgt;
+	struct dma_chan *chan;
+	const void *buf, *pbuf;
+	size_t len = t->len;
+	int i, ret, nents;
+
+	if (bits_per_word(espi) > 8)
+		buswidth = DMA_SLAVE_BUSWIDTH_2_BYTES;
+	else
+		buswidth = DMA_SLAVE_BUSWIDTH_1_BYTE;
+
+	memset(&conf, 0, sizeof(conf));
+	conf.direction = dir;
+
+	if (dir == DMA_FROM_DEVICE) {
+		chan = espi->dma_rx;
+		buf = t->rx_buf;
+		sgt = &espi->rx_sgt;
+
+		conf.src_addr = espi->sspdr_phys;
+		conf.src_addr_width = buswidth;
+	} else {
+		chan = espi->dma_tx;
+		buf = t->tx_buf;
+		sgt = &espi->tx_sgt;
+
+		conf.dst_addr = espi->sspdr_phys;
+		conf.dst_addr_width = buswidth;
+	}
+
+	ret = dmaengine_slave_config(chan, &conf);
+	if (ret)
+		return ERR_PTR(ret);
+
+	/*
+	 * We need to split the transfer into PAGE_SIZE'd chunks. This is
+	 * because we are using @espi->zeropage to provide a zero RX buffer
+	 * for the TX transfers and we have only allocated one page for that.
+	 *
+	 * For performance reasons we allocate a new sg_table only when
+	 * needed. Otherwise we will re-use the current one. Eventually the
+	 * last sg_table is released in ep93xx_spi_release_dma().
+	 */
+
+	nents = DIV_ROUND_UP(len, PAGE_SIZE);
+	if (nents != sgt->nents) {
+		sg_free_table(sgt);
+
+		ret = sg_alloc_table(sgt, nents, GFP_KERNEL);
+		if (ret)
+			return ERR_PTR(ret);
+	}
+
+	pbuf = buf;
+	for_each_sg(sgt->sgl, sg, sgt->nents, i) {
+		size_t bytes = min_t(size_t, len, PAGE_SIZE);
+
+		if (buf) {
+			sg_set_page(sg, virt_to_page(pbuf), bytes,
+				    offset_in_page(pbuf));
+		} else {
+			sg_set_page(sg, virt_to_page(espi->zeropage),
+				    bytes, 0);
+		}
+
+		pbuf += bytes;
+		len -= bytes;
+	}
+
+	if (WARN_ON(len)) {
+		dev_warn(&espi->pdev->dev, "len = %d expected 0!", len);
+		return ERR_PTR(-EINVAL);
+	}
+
+	nents = dma_map_sg(chan->device->dev, sgt->sgl, sgt->nents, dir);
+	if (!nents)
+		return ERR_PTR(-ENOMEM);
+
+	txd = chan->device->device_prep_slave_sg(chan, sgt->sgl, nents,
+						 dir, DMA_CTRL_ACK);
+	if (!txd) {
+		dma_unmap_sg(chan->device->dev, sgt->sgl, sgt->nents, dir);
+		return ERR_PTR(-ENOMEM);
+	}
+	return txd;
+}
+
+/**
+ * ep93xx_spi_dma_finish() - finishes with a DMA transfer
+ * @espi: ep93xx SPI controller struct
+ * @dir: DMA transfer direction
+ *
+ * Function finishes with the DMA transfer. After this, the DMA buffer is
+ * unmapped.
+ */
+static void ep93xx_spi_dma_finish(struct ep93xx_spi *espi,
+				  enum dma_data_direction dir)
+{
+	struct dma_chan *chan;
+	struct sg_table *sgt;
+
+	if (dir == DMA_FROM_DEVICE) {
+		chan = espi->dma_rx;
+		sgt = &espi->rx_sgt;
+	} else {
+		chan = espi->dma_tx;
+		sgt = &espi->tx_sgt;
+	}
+
+	dma_unmap_sg(chan->device->dev, sgt->sgl, sgt->nents, dir);
+}
+
+static void ep93xx_spi_dma_callback(void *callback_param)
+{
+	complete(callback_param);
+}
+
+static void ep93xx_spi_dma_transfer(struct ep93xx_spi *espi)
+{
+	struct spi_message *msg = espi->current_msg;
+	struct dma_async_tx_descriptor *rxd, *txd;
+
+	rxd = ep93xx_spi_dma_prepare(espi, DMA_FROM_DEVICE);
+	if (IS_ERR(rxd)) {
+		dev_err(&espi->pdev->dev, "DMA RX failed: %ld\n", PTR_ERR(rxd));
+		msg->status = PTR_ERR(rxd);
+		return;
+	}
+
+	txd = ep93xx_spi_dma_prepare(espi, DMA_TO_DEVICE);
+	if (IS_ERR(txd)) {
+		ep93xx_spi_dma_finish(espi, DMA_FROM_DEVICE);
+		dev_err(&espi->pdev->dev, "DMA TX failed: %ld\n", PTR_ERR(rxd));
+		msg->status = PTR_ERR(txd);
+		return;
+	}
+
+	/* We are ready when RX is done */
+	rxd->callback = ep93xx_spi_dma_callback;
+	rxd->callback_param = &espi->wait;
+
+	/* Now submit both descriptors and wait while they finish */
+	dmaengine_submit(rxd);
+	dmaengine_submit(txd);
+
+	dma_async_issue_pending(espi->dma_rx);
+	dma_async_issue_pending(espi->dma_tx);
+
+	wait_for_completion(&espi->wait);
+
+	ep93xx_spi_dma_finish(espi, DMA_TO_DEVICE);
+	ep93xx_spi_dma_finish(espi, DMA_FROM_DEVICE);
+}
+
 /**
  * ep93xx_spi_process_transfer() - processes one SPI transfer
  * @espi: ep93xx SPI controller struct
@@ -556,13 +757,14 @@ static void ep93xx_spi_process_transfer(struct ep93xx_spi *espi,
 	espi->tx = 0;
 
 	/*
-	 * Now everything is set up for the current transfer. We prime the TX
-	 * FIFO, enable interrupts, and wait for the transfer to complete.
+	 * There is no point of setting up DMA for the transfers which will
+	 * fit into the FIFO and can be transferred with a single interrupt.
+	 * So in these cases we will be using PIO and don't bother for DMA.
 	 */
-	if (ep93xx_spi_read_write(espi)) {
-		ep93xx_spi_enable_interrupts(espi);
-		wait_for_completion(&espi->wait);
-	}
+	if (espi->dma_rx && t->len > SPI_FIFO_SIZE)
+		ep93xx_spi_dma_transfer(espi);
+	else
+		ep93xx_spi_pio_transfer(espi);
 
 	/*
 	 * In case of error during transmit, we bail out from processing
@@ -571,6 +773,8 @@ static void ep93xx_spi_process_transfer(struct ep93xx_spi *espi,
 	if (msg->status)
 		return;
 
+	msg->actual_length += t->len;
+
 	/*
 	 * After this transfer is finished, perform any possible
 	 * post-transfer actions requested by the protocol driver.
@@ -752,6 +956,75 @@ static irqreturn_t ep93xx_spi_interrupt(int irq, void *dev_id)
 	return IRQ_HANDLED;
 }
 
+static bool ep93xx_spi_dma_filter(struct dma_chan *chan, void *filter_param)
+{
+	if (ep93xx_dma_chan_is_m2p(chan))
+		return false;
+
+	chan->private = filter_param;
+	return true;
+}
+
+static int ep93xx_spi_setup_dma(struct ep93xx_spi *espi)
+{
+	dma_cap_mask_t mask;
+	int ret;
+
+	espi->zeropage = (void *)get_zeroed_page(GFP_KERNEL);
+	if (!espi->zeropage)
+		return -ENOMEM;
+
+	dma_cap_zero(mask);
+	dma_cap_set(DMA_SLAVE, mask);
+
+	espi->dma_rx_data.port = EP93XX_DMA_SSP;
+	espi->dma_rx_data.direction = DMA_FROM_DEVICE;
+	espi->dma_rx_data.name = "ep93xx-spi-rx";
+
+	espi->dma_rx = dma_request_channel(mask, ep93xx_spi_dma_filter,
+					   &espi->dma_rx_data);
+	if (!espi->dma_rx) {
+		ret = -ENODEV;
+		goto fail_free_page;
+	}
+
+	espi->dma_tx_data.port = EP93XX_DMA_SSP;
+	espi->dma_tx_data.direction = DMA_TO_DEVICE;
+	espi->dma_tx_data.name = "ep93xx-spi-tx";
+
+	espi->dma_tx = dma_request_channel(mask, ep93xx_spi_dma_filter,
+					   &espi->dma_tx_data);
+	if (!espi->dma_tx) {
+		ret = -ENODEV;
+		goto fail_release_rx;
+	}
+
+	return 0;
+
+fail_release_rx:
+	dma_release_channel(espi->dma_rx);
+	espi->dma_rx = NULL;
+fail_free_page:
+	free_page((unsigned long)espi->zeropage);
+
+	return ret;
+}
+
+static void ep93xx_spi_release_dma(struct ep93xx_spi *espi)
+{
+	if (espi->dma_rx) {
+		dma_release_channel(espi->dma_rx);
+		sg_free_table(&espi->rx_sgt);
+	}
+	if (espi->dma_tx) {
+		dma_release_channel(espi->dma_tx);
+		sg_free_table(&espi->tx_sgt);
+	}
+
+	if (espi->zeropage)
+		free_page((unsigned long)espi->zeropage);
+}
+
 static int __init ep93xx_spi_probe(struct platform_device *pdev)
 {
 	struct spi_master *master;
@@ -818,6 +1091,7 @@ static int __init ep93xx_spi_probe(struct platform_device *pdev)
 		goto fail_put_clock;
 	}
 
+	espi->sspdr_phys = res->start + SSPDR;
 	espi->regs_base = ioremap(res->start, resource_size(res));
 	if (!espi->regs_base) {
 		dev_err(&pdev->dev, "failed to map resources\n");
@@ -832,10 +1106,13 @@ static int __init ep93xx_spi_probe(struct platform_device *pdev)
 		goto fail_unmap_regs;
 	}
 
+	if (info->use_dma && ep93xx_spi_setup_dma(espi))
+		dev_warn(&pdev->dev, "DMA setup failed. Falling back to PIO\n");
+
 	espi->wq = create_singlethread_workqueue("ep93xx_spid");
 	if (!espi->wq) {
 		dev_err(&pdev->dev, "unable to create workqueue\n");
-		goto fail_free_irq;
+		goto fail_free_dma;
 	}
 	INIT_WORK(&espi->msg_work, ep93xx_spi_work);
 	INIT_LIST_HEAD(&espi->msg_queue);
@@ -857,7 +1134,8 @@ static int __init ep93xx_spi_probe(struct platform_device *pdev)
 
 fail_free_queue:
 	destroy_workqueue(espi->wq);
-fail_free_irq:
+fail_free_dma:
+	ep93xx_spi_release_dma(espi);
 	free_irq(espi->irq, espi);
 fail_unmap_regs:
 	iounmap(espi->regs_base);
@@ -901,6 +1179,7 @@ static int __exit ep93xx_spi_remove(struct platform_device *pdev)
 	}
 	spin_unlock_irq(&espi->lock);
 
+	ep93xx_spi_release_dma(espi);
 	free_irq(espi->irq, espi);
 	iounmap(espi->regs_base);
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
Signature · 1 line
1.7.4.4
#22 lore raw

Re: [PATCH v2 5/5] spi/ep93xx: add DMA support

Quoted 8 lines · Grant Likely
Quoted 7 lines · Mika Westerberg

This patch adds DMA support for the EP93xx SPI driver. By default the DMA is not enabled but it can be enabled by setting ep93xx_spi_info.use_dma to true in board configuration file.

Note that the SPI driver still uses PIO for small transfers (<= 8 bytes) for performance reasons.

Quoted 7 lines
Quoted 3 lines

Since this depends on the DMA patches, it can go in via the same tree.

I just realized that once the SPI driver renaming patch (spi: reorganize drivers) enters linux-next, this patch (which sits on Vinod's tree) will cause a merge conflict. Any ideas how to avoid it beforehand?

#23 lore raw

Re: [PATCH v2 5/5] spi/ep93xx: add DMA support

Quoted 13 lines · Mika Westerberg
Quoted 12 lines · Grant Likely
Quoted 10 lines · Mika Westerberg

This patch adds DMA support for the EP93xx SPI driver. By default the DMA is not enabled but it can be enabled by setting ep93xx_spi_info.use_dma to true in board configuration file.

Note that the SPI driver still uses PIO for small transfers (<= 8 bytes) for performance reasons.

Quoted 7 lines
Quoted 3 lines

Since this depends on the DMA patches, it can go in via the same tree.

I just realized that once the SPI driver renaming patch (spi: reorganize drivers) enters linux-next, this patch (which sits on Vinod's tree) will cause a merge conflict. Any ideas how to avoid it beforehand?

Yes, put the whole series into a separate branch all by itself. Merge that branch into Vinod's tree and I'll also merge it into spi/next, and I'll fix up the merge conflict when I do.

g.

Signature · 2 lines
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
#24 lore raw

Re: [PATCH v2 5/5] spi/ep93xx: add DMA support

Quoted 9 lines · Grant Likely
Quoted 4 lines · Mika Westerberg

I just realized that once the SPI driver renaming patch (spi: reorganize drivers) enters linux-next, this patch (which sits on Vinod's tree) will cause a merge conflict. Any ideas how to avoid it beforehand?

Yes, put the whole series into a separate branch all by itself. Merge that branch into Vinod's tree and I'll also merge it into spi/next, and I'll fix up the merge conflict when I do.

More stupid questions: Do you mean that I create a branch in my public repository somewhere? If that is the case, then there is a problem that I don't have any public repository and I doubt that I get such before linux-next is rebuilt.

#25 lore raw

Re: [PATCH v2 5/5] spi/ep93xx: add DMA support

Quoted 7 lines · Mika Westerberg
Quoted 6 lines · Grant Likely
Quoted 4 lines · Mika Westerberg

I just realized that once the SPI driver renaming patch (spi: reorganize drivers) enters linux-next, this patch (which sits on Vinod's tree) will cause a merge conflict. Any ideas how to avoid it beforehand?

Quoted 8 lines
Quoted 3 lines

Yes, put the whole series into a separate branch all by itself. Merge that branch into Vinod's tree and I'll also merge it into spi/next, and I'll fix up the merge conflict when I do.

More stupid questions: Do you mean that I create a branch in my public repository somewhere? If that is the case, then there is a problem that I don't have any public repository and I doubt that I get such before linux-next is rebuilt.

It doesn't have to be your repo. Vinod could do it, or I could.

g.

#26 lore raw

Re: [PATCH v2 5/5] spi/ep93xx: add DMA support

Quoted 12 lines · Grant Likely
Quoted 11 lines · Mika Westerberg
Quoted 9 lines · Grant Likely
Quoted 4 lines · Mika Westerberg

I just realized that once the SPI driver renaming patch (spi: reorganize drivers) enters linux-next, this patch (which sits on Vinod's tree) will cause a merge conflict. Any ideas how to avoid it beforehand?

Yes, put the whole series into a separate branch all by itself. Merge that branch into Vinod's tree and I'll also merge it into spi/next, and I'll fix up the merge conflict when I do.

Quoted 6 lines
Quoted 4 lines

More stupid questions: Do you mean that I create a branch in my public repository somewhere? If that is the case, then there is a problem that I don't have any public repository and I doubt that I get such before linux-next is rebuilt.

It doesn't have to be your repo. Vinod could do it, or I could.

Ah, I see.

Would it then be possible that you could do it? Please let me and Vinod know what is needed from us.

And sorry for this mess.

#27 lore raw

Re: [PATCH v2 5/5] spi/ep93xx: add DMA support

Quoted 18 lines · Mika Westerberg
Quoted 17 lines · Grant Likely
Quoted 15 lines · Mika Westerberg
Quoted 9 lines · Grant Likely
Quoted 4 lines · Mika Westerberg

I just realized that once the SPI driver renaming patch (spi: reorganize drivers) enters linux-next, this patch (which sits on Vinod's tree) will cause a merge conflict. Any ideas how to avoid it beforehand?

Yes, put the whole series into a separate branch all by itself. Merge that branch into Vinod's tree and I'll also merge it into spi/next, and I'll fix up the merge conflict when I do.

More stupid questions: Do you mean that I create a branch in my public repository somewhere? If that is the case, then there is a problem that I don't have any public repository and I doubt that I get such before linux-next is rebuilt.

Quoted 8 lines
Quoted 1 line

It doesn't have to be your repo. Vinod could do it, or I could.

Ah, I see.

Would it then be possible that you could do it? Please let me and Vinod know what is needed from us.

And sorry for this mess.

I'll need an ack from Vinod first for the series so that I can add it before I make the commits, but other than that I have no problem doing so.

g.

Acked-by
#28 lore raw

Re: [PATCH v2 5/5] spi/ep93xx: add DMA support

Quoted 23 lines · Grant Likely
Quoted 22 lines · Mika Westerberg
Quoted 12 lines · Grant Likely
Quoted 11 lines · Mika Westerberg
Quoted 9 lines · Grant Likely
Quoted 4 lines · Mika Westerberg

I just realized that once the SPI driver renaming patch (spi: reorganize drivers) enters linux-next, this patch (which sits on Vinod's tree) will cause a merge conflict. Any ideas how to avoid it beforehand?

Yes, put the whole series into a separate branch all by itself. Merge that branch into Vinod's tree and I'll also merge it into spi/next, and I'll fix up the merge conflict when I do.

Quoted 6 lines
Quoted 4 lines

More stupid questions: Do you mean that I create a branch in my public repository somewhere? If that is the case, then there is a problem that I don't have any public repository and I doubt that I get such before linux-next is rebuilt.

It doesn't have to be your repo. Vinod could do it, or I could.

Ah, I see.

Quoted 8 lines
Quoted 4 lines

Would it then be possible that you could do it? Please let me and Vinod know what is needed from us.

And sorry for this mess.

I'll need an ack from Vinod first for the series so that I can add it before I make the commits, but other than that I have no problem doing so.

Let me know which branch you have pushed and I will merge that to my tree

Signature · 1 line
~Vinod
#29 lore raw

Re: [PATCH v2 5/5] spi/ep93xx: add DMA support

Quoted 29 lines · Vinod
Quoted 28 lines · Grant Likely
Quoted 26 lines · Mika Westerberg
Quoted 12 lines · Grant Likely
Quoted 11 lines · Mika Westerberg
Quoted 9 lines · Grant Likely
Quoted 4 lines · Mika Westerberg

I just realized that once the SPI driver renaming patch (spi: reorganize drivers) enters linux-next, this patch (which sits on Vinod's tree) will cause a merge conflict. Any ideas how to avoid it beforehand?

Yes, put the whole series into a separate branch all by itself. Merge that branch into Vinod's tree and I'll also merge it into spi/next, and I'll fix up the merge conflict when I do.

Quoted 6 lines
Quoted 4 lines

More stupid questions: Do you mean that I create a branch in my public repository somewhere? If that is the case, then there is a problem that I don't have any public repository and I doubt that I get such before linux-next is rebuilt.

It doesn't have to be your repo. Vinod could do it, or I could.

Ah, I see.

Would it then be possible that you could do it? Please let me and Vinod know what is needed from us.

And sorry for this mess.

Quoted 7 lines
Quoted 3 lines

I'll need an ack from Vinod first for the series so that I can add it before I make the commits, but other than that I have no problem doing so.

Let me know which branch you have pushed and I will merge that to my tree

Just pushed out to the branch below. Take a look, make sure it is correct, and if it looks good to you then go ahead and merge it, and I ll also merge it into spi/next.

The following changes since commit 59c5f46fbe01a00eedf54a23789634438bb80603:

Linux 3.0-rc2 (2011-06-06 18:06:33 +0900)

are available in the git repository at:
git://git.secretlab.ca/git/linux-2.6 ep93xx-dma

Geert Uytterhoeven (1):
spi/rtc-m41t93: Use spi_get_drvdata() for SPI devices

Govindraj.R (1):
spi/omap2: fix uninitialized variable

Grant Likely (1):
Merge remote-tracking branch 'origin' into spi/merge

Mika Westerberg (5):
dmaengine: add ep93xx DMA support
ep93xx: add dmaengine platform code
ASoC: ep93xx: convert to use the DMA engine API
ep93xx: remove the old M2P DMA code spi/ep93xx: add DMA support

 Documentation/spi/ep93xx_spi                   |   10 +
 arch/arm/mach-ep93xx/Makefile                  |    4 +-
 arch/arm/mach-ep93xx/core.c                    |    6 +-
 arch/arm/mach-ep93xx/dma-m2p.c                 |  411 -------
 arch/arm/mach-ep93xx/dma.c                     |  108 ++
 arch/arm/mach-ep93xx/include/mach/dma.h        |  190 ++---
 arch/arm/mach-ep93xx/include/mach/ep93xx_spi.h |    2 +
 drivers/dma/Kconfig                            |    7 +
 drivers/dma/Makefile                           |    1 +
 drivers/dma/ep93xx_dma.c                       | 1355 ++++++++++++++++++++++++
 drivers/rtc/rtc-m41t93.c                       |    2 +-
 drivers/spi/ep93xx_spi.c                       |  303 +++++-
 drivers/spi/omap2_mcspi.c                      |    2 +-
 sound/soc/ep93xx/ep93xx-ac97.c                 |    4 +-
 sound/soc/ep93xx/ep93xx-i2s.c                  |    4 +-
 sound/soc/ep93xx/ep93xx-pcm.c                  |  137 ++--
 16 files changed, 1932 insertions(+), 614 deletions(-)
 delete mode 100644 arch/arm/mach-ep93xx/dma-m2p.c
 create mode 100644 arch/arm/mach-ep93xx/dma.c
 create mode 100644 drivers/dma/ep93xx_dma.c
#30 lore raw

Re: [PATCH v2 5/5] spi/ep93xx: add DMA support

Quoted 77 lines · Grant Likely
Quoted 29 lines · Vinod
Quoted 28 lines · Grant Likely
Quoted 26 lines · Mika Westerberg
Quoted 12 lines · Grant Likely
Quoted 11 lines · Mika Westerberg
Quoted 9 lines · Grant Likely
Quoted 4 lines · Mika Westerberg

I just realized that once the SPI driver renaming patch (spi: reorganize drivers) enters linux-next, this patch (which sits on Vinod's tree) will cause a merge conflict. Any ideas how to avoid it beforehand?

Yes, put the whole series into a separate branch all by itself. Merge that branch into Vinod's tree and I'll also merge it into spi/next, and I'll fix up the merge conflict when I do.

Quoted 6 lines
Quoted 4 lines

More stupid questions: Do you mean that I create a branch in my public repository somewhere? If that is the case, then there is a problem that I don't have any public repository and I doubt that I get such before linux-next is rebuilt.

It doesn't have to be your repo. Vinod could do it, or I could.

Ah, I see.

Would it then be possible that you could do it? Please let me and Vinod know what is needed from us.

And sorry for this mess.

Quoted 7 lines
Quoted 3 lines

I'll need an ack from Vinod first for the series so that I can add it before I make the commits, but other than that I have no problem doing so.

Let me know which branch you have pushed and I will merge that to my tree

Just pushed out to the branch below. Take a look, make sure it is correct, and if it looks good to you then go ahead and merge it, and I ll also merge it into spi/next.

The following changes since commit 59c5f46fbe01a00eedf54a23789634438bb80603:

Linux 3.0-rc2 (2011-06-06 18:06:33 +0900)

are available in the git repository at:
git://git.secretlab.ca/git/linux-2.6 ep93xx-dma

Geert Uytterhoeven (1):
spi/rtc-m41t93: Use spi_get_drvdata() for SPI devices

Govindraj.R (1):
spi/omap2: fix uninitialized variable

Grant Likely (1):
Merge remote-tracking branch 'origin' into spi/merge

Mika Westerberg (5):
dmaengine: add ep93xx DMA support
ep93xx: add dmaengine platform code
ASoC: ep93xx: convert to use the DMA engine API
ep93xx: remove the old M2P DMA code spi/ep93xx: add DMA support

 Documentation/spi/ep93xx_spi                   |   10 +
 arch/arm/mach-ep93xx/Makefile                  |    4 +-
 arch/arm/mach-ep93xx/core.c                    |    6 +-
 arch/arm/mach-ep93xx/dma-m2p.c                 |  411 -------
 arch/arm/mach-ep93xx/dma.c                     |  108 ++
 arch/arm/mach-ep93xx/include/mach/dma.h        |  190 ++---
 arch/arm/mach-ep93xx/include/mach/ep93xx_spi.h |    2 +
 drivers/dma/Kconfig                            |    7 +
 drivers/dma/Makefile                           |    1 +
 drivers/dma/ep93xx_dma.c                       | 1355 ++++++++++++++++++++++++
 drivers/rtc/rtc-m41t93.c                       |    2 +-
 drivers/spi/ep93xx_spi.c                       |  303 +++++-
Quoted 8 lines
 drivers/spi/omap2_mcspi.c                      |    2 +-
 sound/soc/ep93xx/ep93xx-ac97.c                 |    4 +-
 sound/soc/ep93xx/ep93xx-i2s.c                  |    4 +-
 sound/soc/ep93xx/ep93xx-pcm.c                  |  137 ++--
 16 files changed, 1932 insertions(+), 614 deletions(-)
 delete mode 100644 arch/arm/mach-ep93xx/dma-m2p.c
 create mode 100644 arch/arm/mach-ep93xx/dma.c
 create mode 100644 drivers/dma/ep93xx_dma.c

Thanks, I have merged them into my slave-dma next.

Signature · 1 line
~Vinod
#31 lore raw

Re: [PATCH v2 5/5] spi/ep93xx: add DMA support

Quoted 11 lines · Vinod
Quoted 10 lines · Grant Likely
Quoted 4 lines · Vinod

Let me know which branch you have pushed and I will merge that to my tree

Just pushed out to the branch below. Take a look, make sure it is correct, and if it looks good to you then go ahead and merge it, and I ll also merge it into spi/next.

Quoted 8 lines
Quoted 6 lines

The following changes since commit 59c5f46fbe01a00eedf54a23789634438bb80603:

Linux 3.0-rc2 (2011-06-06 18:06:33 +0900)

are available in the git repository at:
git://git.secretlab.ca/git/linux-2.6 ep93xx-dma

Thanks, I have merged them into my slave-dma next.

Good. I've merged it into spi/next also.

g.

#32 lore raw

Re: [PATCH v2 5/5] spi/ep93xx: add DMA support

Quoted 4 lines · Grant Likely
Quoted 1 line · Vinod

Thanks, I have merged them into my slave-dma next.

Good. I've merged it into spi/next also.

Thanks guys!

#33 lore raw
In reply to Mika Westerberg

Vinod,

As this series has acks for all the subsystem maintainers, would it be ok for you to take the entire series via your tree? Or do you have any idea how to get it merged?

Quoted 52 lines · Mika Westerberg

This is an updated version of the ep93xx DMA patches. Previous version can be found here: https://lkml.org/lkml/2011/5/22/86.

Changes to v1:
* removed unnecessary header
* corrected SPI driver documentation
* DMA driver platform code is only compiled when CONFIG_EP93XX_DMA is enabled

I tried to put all the acks in place, hope I got them right.

There is a dependency between patch 1 and patch 4 which I'm not entirely sure how to solve. Basically it is required that we have patch 1 applied before patch 4 or merge conflict results.

Otherwise it shouldn't matter in which order the patches arrive to the mainline.

Unless someone has a better idea, I suggest that these patches will go through their respective subsystem trees. All the maintainers should be copied.

Thanks,
MW

Mika Westerberg (5):
dmaengine: add ep93xx DMA support
ep93xx: add dmaengine platform code
ASoC: ep93xx: convert to use the DMA engine API
ep93xx: remove the old M2P DMA code
spi/ep93xx: add DMA support

 Documentation/spi/ep93xx_spi                   |   10 +
 arch/arm/mach-ep93xx/Makefile                  |    4 +-
 arch/arm/mach-ep93xx/core.c                    |    6 +-
 arch/arm/mach-ep93xx/dma-m2p.c                 |  411 -------
 arch/arm/mach-ep93xx/dma.c                     |  108 ++
 arch/arm/mach-ep93xx/include/mach/dma.h        |  190 ++---
 arch/arm/mach-ep93xx/include/mach/ep93xx_spi.h |    2 +
 drivers/dma/Kconfig                            |    7 +
 drivers/dma/Makefile                           |    1 +
 drivers/dma/ep93xx_dma.c                       | 1355 ++++++++++++++++++++++++
 drivers/spi/ep93xx_spi.c                       |  303 +++++-
 sound/soc/ep93xx/ep93xx-ac97.c                 |    4 +-
 sound/soc/ep93xx/ep93xx-i2s.c                  |    4 +-
 sound/soc/ep93xx/ep93xx-pcm.c                  |  137 ++--
 14 files changed, 1930 insertions(+), 612 deletions(-)
 delete mode 100644 arch/arm/mach-ep93xx/dma-m2p.c
 create mode 100644 arch/arm/mach-ep93xx/dma.c
 create mode 100644 drivers/dma/ep93xx_dma.c
Signature · 1 line
1.7.4.4
#34 lore raw
Quoted 5 lines · Mika Westerberg

Vinod,

As this series has acks for all the subsystem maintainers, would it be ok for you to take the entire series via your tree? Or do you have any idea how to get it merged?

Please don't top post :(

I have applied this series to next including the asoc and spi changes, if anyone has any objections please let me know

Quoted 59 lines · Mika Westerberg
Quoted 41 lines

This is an updated version of the ep93xx DMA patches. Previous version can be found here: https://lkml.org/lkml/2011/5/22/86.

Changes to v1:
* removed unnecessary header
* corrected SPI driver documentation
* DMA driver platform code is only compiled when CONFIG_EP93XX_DMA is enabled

I tried to put all the acks in place, hope I got them right.

There is a dependency between patch 1 and patch 4 which I'm not entirely sure how to solve. Basically it is required that we have patch 1 applied before patch 4 or merge conflict results.

Otherwise it shouldn't matter in which order the patches arrive to the mainline.

Unless someone has a better idea, I suggest that these patches will go through their respective subsystem trees. All the maintainers should be copied.

Thanks,
MW

Mika Westerberg (5):
dmaengine: add ep93xx DMA support
ep93xx: add dmaengine platform code
ASoC: ep93xx: convert to use the DMA engine API
ep93xx: remove the old M2P DMA code
spi/ep93xx: add DMA support

 Documentation/spi/ep93xx_spi                   |   10 +
 arch/arm/mach-ep93xx/Makefile                  |    4 +-
 arch/arm/mach-ep93xx/core.c                    |    6 +-
 arch/arm/mach-ep93xx/dma-m2p.c                 |  411 -------
 arch/arm/mach-ep93xx/dma.c                     |  108 ++
 arch/arm/mach-ep93xx/include/mach/dma.h        |  190 ++---
 arch/arm/mach-ep93xx/include/mach/ep93xx_spi.h |    2 +
 drivers/dma/Kconfig                            |    7 +
 drivers/dma/Makefile                           |    1 +
 drivers/dma/ep93xx_dma.c                       | 1355 ++++++++++++++++++++++++
Quoted 11 lines
 drivers/spi/ep93xx_spi.c                       |  303 +++++-
 sound/soc/ep93xx/ep93xx-ac97.c                 |    4 +-
 sound/soc/ep93xx/ep93xx-i2s.c                  |    4 +-
 sound/soc/ep93xx/ep93xx-pcm.c                  |  137 ++--
 14 files changed, 1930 insertions(+), 612 deletions(-)
 delete mode 100644 arch/arm/mach-ep93xx/dma-m2p.c
 create mode 100644 arch/arm/mach-ep93xx/dma.c
 create mode 100644 drivers/dma/ep93xx_dma.c
Signature · 1 line
1.7.4.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

Signature · 1 line
~Vinod
#35 lore raw
Quoted 3 lines · Vinod

I have applied this series to next including the asoc and spi changes, if anyone has any objections please let me know

Great, thanks!

I believe that this was the best option considering that now we don't have to worry about dependencies.