Skip to contentSkip to conversation

dw_dmac: move to own folder and split

PATCH In review Andy Shevchenko 6 participants 24 messages Jun 5, 2013 – Jun 12, 2013

Subsystems (2)
lore
Share & tools
lore

Andy Shevchenko

author reviewer
#0 lore raw

v2 cover dw_dmac: move to own folder and split

This is split of the dw_dmac driver as suggested by Arnd et al [1,2]. There are three most important patches:
2/4 moves driver to its own folder
3/4 does the actual split
4/4 introduces PCI part of the driver

During this files are renamed: mostly means that dw_dmac prefix is eliminated. I hope to get it ready to be included in v3.11.

[1] http://www.spinics.net/lists/kernel/msg1408174.html
[2] http://www.spinics.net/lists/kernel/msg1408495.html

Changes v1->v2:
- address Arnd's comments
- compile test when !CONFIG_PM
- apply ACKs

Cnages v0->v1:
- apply Viresh's ACKs
- append PCI part of the driver
- test altogether on Intel Medfield
- add 1/4 to the series as it based on it, but Vinod didn't apply it yet to his tree.

Andy Shevchenko (4):
dw_dmac: don't check resource with devm_ioremap_resource
dma: move dw_dmac driver to an own directory
dma: dw: split driver to library part and platform code
dma: dw: add PCI part of the driver

 MAINTAINERS                               |   3 +-
 drivers/dma/Kconfig                       |  20 +-
 drivers/dma/Makefile                      |   2 +-
 drivers/dma/dw/Kconfig                    |  36 ++++
 drivers/dma/dw/Makefile                   |   8 +
 drivers/dma/{dw_dmac.c => dw/core.c}      | 316 ++++-------------------------
 drivers/dma/dw/internal.h                 |  70 +++++++
 drivers/dma/dw/pci.c                      | 101 ++++++++++
 drivers/dma/dw/platform.c                 | 317 ++++++++++++++++++++++++++++++
 drivers/dma/{dw_dmac_regs.h => dw/regs.h} |   1 +
 10 files changed, 573 insertions(+), 301 deletions(-)
 create mode 100644 drivers/dma/dw/Kconfig
 create mode 100644 drivers/dma/dw/Makefile
 rename drivers/dma/{dw_dmac.c => dw/core.c} (85%)
 create mode 100644 drivers/dma/dw/internal.h
 create mode 100644 drivers/dma/dw/pci.c
 create mode 100644 drivers/dma/dw/platform.c
 rename drivers/dma/{dw_dmac_regs.h => dw/regs.h} (99%)
Signature · 1 line
1.8.2.rc0.22.gb3600c3
author reviewer
#1 lore raw

PATCH v2 1/4 dw_dmac: don't check resource with devm_ioremap_resource

devm_ioremap_resource does sanity checks on the given resource. No need to duplicate this in the driver.

---
 drivers/dma/dw_dmac.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/dma/dw_dmac.c +1 -4
index 724083d..2b65ba6 100644
@@ -1667,14 +1667,11 @@ static int dw_probe(struct platform_device *pdev)
 	int			err;
 	int			i;
 
-	io = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	if (!io)
-		return -EINVAL;
-
 	irq = platform_get_irq(pdev, 0);
 	if (irq < 0)
 		return irq;
 
+	io = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	regs = devm_ioremap_resource(&pdev->dev, io);
 	if (IS_ERR(regs))
 		return PTR_ERR(regs);
Signature · 1 line
1.8.2.rc0.22.gb3600c3
author reviewer
#2 lore raw

PATCH v2 2/4 dma: move dw_dmac driver to an own directory

In reply to Andy Shevchenko

The dw_dmac driver is going to be split into multiple files. To make this more convenient move it to an own directory.

---
 MAINTAINERS                         |  3 +--
 drivers/dma/Kconfig                 | 20 +-------------------
 drivers/dma/Makefile                |  2 +-
 drivers/dma/dw/Kconfig              | 23 +++++++++++++++++++++++
 drivers/dma/dw/Makefile             |  1 +
 drivers/dma/{ => dw}/dw_dmac.c      |  2 +-
 drivers/dma/{ => dw}/dw_dmac_regs.h |  0
 7 files changed, 28 insertions(+), 23 deletions(-)
 create mode 100644 drivers/dma/dw/Kconfig
 create mode 100644 drivers/dma/dw/Makefile
 rename drivers/dma/{ => dw}/dw_dmac.c (99%)
 rename drivers/dma/{ => dw}/dw_dmac_regs.h (100%)
MAINTAINERS +1 -2
index f554c8b..e605ee1 100644
@@ -7005,8 +7005,7 @@ SYNOPSYS DESIGNWARE DMAC DRIVER
 M:	Viresh Kumar <[email protected]>
 S:	Maintained
 F:	include/linux/dw_dmac.h
-F:	drivers/dma/dw_dmac_regs.h
-F:	drivers/dma/dw_dmac.c
+F:	drivers/dma/dw/
 
 SYNOPSYS DESIGNWARE MMC/SD/SDIO DRIVER
 M:	Seungwon Jeon <[email protected]>
drivers/dma/Kconfig +1 -19
index e992489..146a1d8 100644
@@ -79,25 +79,7 @@ config INTEL_IOP_ADMA
 	help
 	  Enable support for the Intel(R) IOP Series RAID engines.
 
-config DW_DMAC
-	tristate "Synopsys DesignWare AHB DMA support"
-	depends on GENERIC_HARDIRQS
-	select DMA_ENGINE
-	default y if CPU_AT32AP7000
-	help
-	  Support the Synopsys DesignWare AHB DMA controller.  This
-	  can be integrated in chips such as the Atmel AT32ap7000.
-
-config DW_DMAC_BIG_ENDIAN_IO
-	bool "Use big endian I/O register access"
-	default y if AVR32
-	depends on DW_DMAC
-	help
-	  Say yes here to use big endian I/O access when reading and writing
-	  to the DMA controller registers. This is needed on some platforms,
-	  like the Atmel AVR32 architecture.
-
-	  If unsure, use the default setting.
+source "drivers/dma/dw/Kconfig"
 
 config AT_HDMAC
 	tristate "Atmel AHB DMA support"
drivers/dma/Makefile +1 -1
index a2b0df5..ac44ca0 100644
@@ -15,7 +15,7 @@ obj-$(CONFIG_FSL_DMA) += fsldma.o
 obj-$(CONFIG_MPC512X_DMA) += mpc512x_dma.o
 obj-$(CONFIG_PPC_BESTCOMM) += bestcomm/
 obj-$(CONFIG_MV_XOR) += mv_xor.o
-obj-$(CONFIG_DW_DMAC) += dw_dmac.o
+obj-$(CONFIG_DW_DMAC) += dw/
 obj-$(CONFIG_AT_HDMAC) += at_hdmac.o
 obj-$(CONFIG_MX3_IPU) += ipu/
 obj-$(CONFIG_TXX9_DMAC) += txx9dmac.o
drivers/dma/dw/Kconfig new file +23 -0
new file mode 100644
index 0000000..38a215a
@@ -0,0 +1,23 @@
+#
+# DMA engine configuration for dw
+#
+
+config DW_DMAC
+	tristate "Synopsys DesignWare AHB DMA support"
+	depends on GENERIC_HARDIRQS
+	select DMA_ENGINE
+	default y if CPU_AT32AP7000
+	help
+	  Support the Synopsys DesignWare AHB DMA controller. This
+	  can be integrated in chips such as the Atmel AT32ap7000.
+
+config DW_DMAC_BIG_ENDIAN_IO
+	bool "Use big endian I/O register access"
+	default y if AVR32
+	depends on DW_DMAC
+	help
+	  Say yes here to use big endian I/O access when reading and writing
+	  to the DMA controller registers. This is needed on some platforms,
+	  like the Atmel AVR32 architecture.
+
+	  If unsure, use the default setting.
drivers/dma/dw/Makefile new file +1 -0
new file mode 100644
index 0000000..dd8d993
@@ -0,0 +1 @@
+obj-$(CONFIG_DW_DMAC) += dw_dmac.o
drivers/dma/dw/dw_dmac.c renamed from drivers/dma/dw_dmac.c +1 -1
similarity index 99%
rename from drivers/dma/dw_dmac.c
rename to drivers/dma/dw/dw_dmac.c
index 2b65ba6..15f3f4f 100644
@@ -28,8 +28,8 @@
 #include <linux/acpi.h>
 #include <linux/acpi_dma.h>
 
+#include "../dmaengine.h"
 #include "dw_dmac_regs.h"
-#include "dmaengine.h"
 
 /*
  * This supports the Synopsys "DesignWare AHB Central DMA Controller",
drivers/dma/dw/dw_dmac_regs.h renamed from drivers/dma/dw_dmac_regs.h +0 -0
similarity index 100%
rename from drivers/dma/dw_dmac_regs.h
rename to drivers/dma/dw/dw_dmac_regs.h
Signature · 1 line
1.8.2.rc0.22.gb3600c3
#3 lore raw

Re: [PATCH v2 2/4] dma: move dw_dmac driver to an own directory

Quoted 14 lines · Andy Shevchenko

The dw_dmac driver is going to be split into multiple files. To make this more convenient move it to an own directory.

---

drivers/dma/dw/Kconfig new file +7 -0
+config DW_DMAC
+	tristate "Synopsys DesignWare AHB DMA support"
+	depends on GENERIC_HARDIRQS
+	select DMA_ENGINE
+	default y if CPU_AT32AP7000
+	help
+	  Support the Synopsys DesignWare AHB DMA controller. This

drivers/dma/dw/Kconfig line 21

Quoted 10 lines
drivers/dma/dw/Kconfig new file +10 -0
+	  can be integrated in chips such as the Atmel AT32ap7000.
+
+config DW_DMAC_BIG_ENDIAN_IO
+	bool "Use big endian I/O register access"
+	default y if AVR32
+	depends on DW_DMAC
+	help
+	  Say yes here to use big endian I/O access when reading and writing
+	  to the DMA controller registers. This is needed on some platforms,
+	  like the Atmel AVR32 architecture.

I know this is derived but should it be selected if AVR32 is defined, this stuff should be user configurable..

Quoted 33 lines
(quoted diff) +2 -0
+
+	  If unsure, use the default setting.
drivers/dma/dw/Makefile new file +1 -0
new file mode 100644
index 0000000..dd8d993
@@ -0,0 +1 @@
+obj-$(CONFIG_DW_DMAC) += dw_dmac.o
drivers/dma/dw/dw_dmac.c renamed from drivers/dma/dw_dmac.c +1 -1
similarity index 99%
rename from drivers/dma/dw_dmac.c
rename to drivers/dma/dw/dw_dmac.c
index 2b65ba6..15f3f4f 100644
@@ -28,8 +28,8 @@
 #include <linux/acpi.h>
 #include <linux/acpi_dma.h>
 
+#include "../dmaengine.h"
 #include "dw_dmac_regs.h"
-#include "dmaengine.h"
 
 /*
  * This supports the Synopsys "DesignWare AHB Central DMA Controller",
drivers/dma/dw/dw_dmac_regs.h renamed from drivers/dma/dw_dmac_regs.h +0 -0
similarity index 100%
rename from drivers/dma/dw_dmac_regs.h
rename to drivers/dma/dw/dw_dmac_regs.h
Signature · 1 line
1.8.2.rc0.22.gb3600c3

--
~Vinod

#4 lore raw

Re: [PATCH v2 2/4] dma: move dw_dmac driver to an own directory

Quoted 19 lines · Vinod Koul
Quoted 18 lines · Andy Shevchenko

The dw_dmac driver is going to be split into multiple files. To make this more convenient move it to an own directory.

---

drivers/dma/dw/Kconfig new file +11 -0
+config DW_DMAC
+     tristate "Synopsys DesignWare AHB DMA support"
+     depends on GENERIC_HARDIRQS
+     select DMA_ENGINE
+     default y if CPU_AT32AP7000
+     help
+       Support the Synopsys DesignWare AHB DMA controller. This
+       can be integrated in chips such as the Atmel AT32ap7000.
+
+config DW_DMAC_BIG_ENDIAN_IO
+     bool "Use big endian I/O register access"
Quoted 8 lines

drivers/dma/dw/Kconfig line 21

Quoted 6 lines
drivers/dma/dw/Kconfig new file +6 -0
+     default y if AVR32
+     depends on DW_DMAC
+     help
+       Say yes here to use big endian I/O access when reading and writing
+       to the DMA controller registers. This is needed on some platforms,
+       like the Atmel AVR32 architecture.

I know this is derived but should it be selected if AVR32 is defined, this stuff should be user configurable..

I'm not sure I get what you meant. User can choose that option via make menuconfig or editing plain .config file.
Or you meant this should be run-time configurable?

--
With Best Regards,
Andy Shevchenko

#5 lore raw

Re: [PATCH v2 2/4] dma: move dw_dmac driver to an own directory

Quoted 29 lines · Andy Shevchenko
Quoted 19 lines · Vinod Koul
Quoted 18 lines · Andy Shevchenko

The dw_dmac driver is going to be split into multiple files. To make this more convenient move it to an own directory.

---

drivers/dma/dw/Kconfig new file +11 -0
+config DW_DMAC
+     tristate "Synopsys DesignWare AHB DMA support"
+     depends on GENERIC_HARDIRQS
+     select DMA_ENGINE
+     default y if CPU_AT32AP7000
+     help
+       Support the Synopsys DesignWare AHB DMA controller. This
+       can be integrated in chips such as the Atmel AT32ap7000.
+
+config DW_DMAC_BIG_ENDIAN_IO
+     bool "Use big endian I/O register access"
Quoted 8 lines

drivers/dma/dw/Kconfig line 21

Quoted 6 lines
drivers/dma/dw/Kconfig new file +6 -0
+     default y if AVR32
+     depends on DW_DMAC
+     help
+       Say yes here to use big endian I/O access when reading and writing
+       to the DMA controller registers. This is needed on some platforms,
+       like the Atmel AVR32 architecture.

I know this is derived but should it be selected if AVR32 is defined, this stuff should be user configurable..

Quoted 3 lines

I'm not sure I get what you meant. User can choose that option via make menuconfig or editing plain .config file.
Or you meant this should be run-time configurable?

Something like
config DW_DMAC_BIG_ENDIAN_IO
tristate

config DW_DMAC
select DW_DMAC_BIG_ENDIAN_IO

I belive DW_DMAC is for AVR support and the PCI ones is different right. The point is that these things should be selected by the required symbols based on what ARCH we are on and not be prompted for user to configure via menuconfig

--
~Vinod

#6 lore raw

Re: [PATCH v2 2/4] dma: move dw_dmac driver to an own directory

Quoted 8 lines · Vinod Koul

Something like
config DW_DMAC_BIG_ENDIAN_IO
tristate

config DW_DMAC
select DW_DMAC_BIG_ENDIAN_IO

I belive DW_DMAC is for AVR support and the PCI ones is different right.

No. DW_DMAC is for ARM as well.

#7 lore raw

Re: [PATCH v2 2/4] dma: move dw_dmac driver to an own directory

In reply to Vinod Koul
Quoted 3 lines · Vinod Koul
Quoted 2 lines · Andy Shevchenko
Quoted 1 line · Vinod Koul

On Wed, Jun 05, 2013 at 03:26:44PM +0300, Andy Shevchenko wrote:

[]

Quoted 10 lines

Something like
config DW_DMAC_BIG_ENDIAN_IO
tristate

config DW_DMAC
select DW_DMAC_BIG_ENDIAN_IO

I belive DW_DMAC is for AVR support and the PCI ones is different right. The point is that these things should be selected by the required symbols based on what ARCH we are on and not be prompted for user to configure via menuconfig

DW_DMAC is a generic platform driver which supports AVR32, ARM and Intel (ACPI case) platforms.

We may do that option invisible to user

and then use

config DW_DMAC
select DW_DMAC_BIG_ENDIAN_IO if ARCH=AVR32

I don't know if we will have any platform in future which has such difference in endianess between CPU and DMA IP block.

--
With Best Regards,
Andy Shevchenko

#8 lore raw

Re: [PATCH v2 2/4] dma: move dw_dmac driver to an own directory

Quoted 14 lines · Andy Shevchenko
Quoted 3 lines · Vinod Koul
Quoted 2 lines · Andy Shevchenko
Quoted 1 line · Vinod Koul

On Wed, Jun 05, 2013 at 03:26:44PM +0300, Andy Shevchenko wrote:

[]

Quoted 7 lines

Something like
config DW_DMAC_BIG_ENDIAN_IO
tristate

config DW_DMAC
select DW_DMAC_BIG_ENDIAN_IO

Quoted 8 lines
Quoted 3 lines

I belive DW_DMAC is for AVR support and the PCI ones is different right. The point is that these things should be selected by the required symbols based on what ARCH we are on and not be prompted for user to configure via menuconfig

DW_DMAC is a generic platform driver which supports AVR32, ARM and Intel (ACPI case) platforms.

We may do that option invisible to user

Yup

Quoted 5 lines

and then use

config DW_DMAC
select DW_DMAC_BIG_ENDIAN_IO if ARCH=AVR32

Thats would be the right way

Quoted 3 lines

I don't know if we will have any platform in future which has such difference in endianess between CPU and DMA IP block.

you never know what h/w designers would think!

--
~Vinod

#9 lore raw

Re: [PATCH v2 2/4] dma: move dw_dmac driver to an own directory

Quoted 19 lines · Vinod Koul
Quoted 18 lines · Andy Shevchenko

On Wed, Jun 12, 2013 at 10:39 AM, Vinod Koul <[email protected]> wrote:

[]

Quoted 10 lines

Something like
config DW_DMAC_BIG_ENDIAN_IO
tristate

config DW_DMAC
select DW_DMAC_BIG_ENDIAN_IO

I belive DW_DMAC is for AVR support and the PCI ones is different right. The point is that these things should be selected by the required symbols based on what ARCH we are on and not be prompted for user to configure via menuconfig

DW_DMAC is a generic platform driver which supports AVR32, ARM and Intel (ACPI case) platforms.

Quoted 8 lines
Quoted 1 line

We may do that option invisible to user

Yup

Quoted 5 lines

and then use

config DW_DMAC
select DW_DMAC_BIG_ENDIAN_IO if ARCH=AVR32

Thats would be the right way

Do you prefer to have this as separate patch or integrated in the split? In my humble opinion I better to do separate patch.

--
With Best Regards,
Andy Shevchenko

#10 lore raw

Re: [PATCH v2 2/4] dma: move dw_dmac driver to an own directory

Quoted 23 lines · Andy Shevchenko
Quoted 22 lines · Vinod Koul
Quoted 11 lines · Andy Shevchenko

On Wed, Jun 12, 2013 at 10:39 AM, Vinod Koul <[email protected]> wrote:

[]

Quoted 7 lines

Something like
config DW_DMAC_BIG_ENDIAN_IO
tristate

config DW_DMAC
select DW_DMAC_BIG_ENDIAN_IO

Quoted 8 lines
Quoted 3 lines

I belive DW_DMAC is for AVR support and the PCI ones is different right. The point is that these things should be selected by the required symbols based on what ARCH we are on and not be prompted for user to configure via menuconfig

DW_DMAC is a generic platform driver which supports AVR32, ARM and Intel (ACPI case) platforms.

We may do that option invisible to user

Yup

Quoted 1 line
Quoted 8 lines
Quoted 5 lines
Quoted 4 lines

and then use

config DW_DMAC
select DW_DMAC_BIG_ENDIAN_IO if ARCH=AVR32

Thats would be the right way

Do you prefer to have this as separate patch or integrated in the split? In my humble opinion I better to do separate patch.

Never mind, am applying your patches and below fix, let me if you guys are okay

drivers/dma/dw/Kconfig +2 -9
index db2b41f..7be1cf8 100644
@@ -10,6 +10,7 @@ config DW_DMAC_CORE
 config DW_DMAC
 	tristate "Synopsys DesignWare AHB DMA platform driver"
 	select DW_DMAC_CORE
+	select DW_DMAC_BIG_ENDIAN_IO if ARCH=AVR32
 	default y if CPU_AT32AP7000
 	help
 	  Support the Synopsys DesignWare AHB DMA controller. This
@@ -25,12 +26,4 @@ config DW_DMAC_PCI
 	  Intel Medfield has integrated this GPDMA controller.
 
 config DW_DMAC_BIG_ENDIAN_IO
-	bool "Use big endian I/O register access"
-	default y if AVR32
-	depends on DW_DMAC_CORE
-	help
-	  Say yes here to use big endian I/O access when reading and writing
-	  to the DMA controller registers. This is needed on some platforms,
-	  like the Atmel AVR32 architecture.
-
-	  If unsure, use the default setting.
+	bool

-

--
~Vinod

#11 lore raw

Re: [PATCH v2 2/4] dma: move dw_dmac driver to an own directory

Quoted 1 line · Vinod Koul

Never mind, am applying your patches and below fix, let me if you guys are okay

I am not :)

Quoted 13 lines
drivers/dma/dw/Kconfig +1 -0
index db2b41f..7be1cf8 100644
@@ -10,6 +10,7 @@ config DW_DMAC_CORE
 config DW_DMAC
        tristate "Synopsys DesignWare AHB DMA platform driver"
        select DW_DMAC_CORE
+       select DW_DMAC_BIG_ENDIAN_IO if ARCH=AVR32
        default y if CPU_AT32AP7000
        help
          Support the Synopsys DesignWare AHB DMA controller. This

drivers/dma/dw/Kconfig config DW_DMAC_PCI · line 34

Quoted 10 lines
drivers/dma/dw/Kconfig +0 -7
@@ -25,12 +26,4 @@ config DW_DMAC_PCI
          Intel Medfield has integrated this GPDMA controller.
 
 config DW_DMAC_BIG_ENDIAN_IO
-       bool "Use big endian I/O register access"
-       default y if AVR32
-       depends on DW_DMAC_CORE
-       help
-         Say yes here to use big endian I/O access when reading and writing
-         to the DMA controller registers. This is needed on some platforms,
-         like the Atmel AVR32 architecture.

This information was useful to understand this config option and must be kept in some way.

#12 lore raw

Re: [PATCH v2 2/4] dma: move dw_dmac driver to an own directory

Quoted 21 lines · Viresh Kumar
Quoted 1 line · Vinod Koul

Never mind, am applying your patches and below fix, let me if you guys are okay

I am not :)

Quoted 15 lines
drivers/dma/dw/Kconfig +1 -0
index db2b41f..7be1cf8 100644
@@ -10,6 +10,7 @@ config DW_DMAC_CORE
 config DW_DMAC
        tristate "Synopsys DesignWare AHB DMA platform driver"
        select DW_DMAC_CORE
+       select DW_DMAC_BIG_ENDIAN_IO if ARCH=AVR32
        default y if CPU_AT32AP7000
        help
          Support the Synopsys DesignWare AHB DMA controller. This
@@ -25,12 +26,4 @@ config DW_DMAC_PCI
          Intel Medfield has integrated this GPDMA controller.
 
Quoted 11 lines

drivers/dma/dw/Kconfig config DW_DMAC_PCI · line 34

Quoted 8 lines
drivers/dma/dw/Kconfig +0 -7
 config DW_DMAC_BIG_ENDIAN_IO
-       bool "Use big endian I/O register access"
-       default y if AVR32
-       depends on DW_DMAC_CORE
-       help
-         Say yes here to use big endian I/O access when reading and writing
-         to the DMA controller registers. This is needed on some platforms,
-         like the Atmel AVR32 architecture.

This information was useful to understand this config option and must be kept in some way.

Well now the config option is not selected by users, so they dont need to know. It was useful in knowing what to select earlier

For documenting, we can add this in commit log or better in driver code where you use this

--
~Vinod

#13 lore raw

Re: [PATCH v2 2/4] dma: move dw_dmac driver to an own directory

Quoted 2 lines · Vinod Koul

Well now the config option is not selected by users, so they dont need to know. It was useful in knowing what to select earlier

I am concerned about driver writers rather than end users as this is fixed for a driver. And yes its better we don't give a choice to users to deselect it.

Quoted 2 lines

For documenting, we can add this in commit log or better in driver code where you use this

Commit log wouldn't be sufficient now. Please add it somewhere in code.

#14 lore raw

Re: [PATCH v2 2/4] dma: move dw_dmac driver to an own directory

In reply to Vinod Koul
Quoted 6 lines · Vinod Koul
Quoted 5 lines · Viresh Kumar
Quoted 1 line · Vinod Koul

Never mind, am applying your patches and below fix, let me if you guys are okay

I am not :)

I

Quoted 27 lines
Quoted 16 lines
Quoted 16 lines
drivers/dma/dw/Kconfig +1 -0
index db2b41f..7be1cf8 100644
@@ -10,6 +10,7 @@ config DW_DMAC_CORE
 config DW_DMAC
        tristate "Synopsys DesignWare AHB DMA platform driver"
        select DW_DMAC_CORE
+       select DW_DMAC_BIG_ENDIAN_IO if ARCH=AVR32
        default y if CPU_AT32AP7000
        help
          Support the Synopsys DesignWare AHB DMA controller. This
@@ -25,12 +26,4 @@ config DW_DMAC_PCI
          Intel Medfield has integrated this GPDMA controller.
 
Quoted 11 lines

drivers/dma/dw/Kconfig config DW_DMAC_PCI · line 34

Quoted 8 lines
drivers/dma/dw/Kconfig +0 -7
 config DW_DMAC_BIG_ENDIAN_IO
-       bool "Use big endian I/O register access"
-       default y if AVR32
-       depends on DW_DMAC_CORE
-       help
-         Say yes here to use big endian I/O access when reading and writing
-         to the DMA controller registers. This is needed on some platforms,
-         like the Atmel AVR32 architecture.

This information was useful to understand this config option and must be kept in some way.

Quoted 5 lines

Well now the config option is not selected by users, so they dont need to know. It was useful in knowing what to select earlier

For documenting, we can add this in commit log or better in driver code where you use this

The driver is better place if you decide to move it (drivers/dma/dw/regs.h).

--
With Best Regards,
Andy Shevchenko

#15 lore raw

Re: [PATCH v2 2/4] dma: move dw_dmac driver to an own directory

Quoted 5 lines · Andy Shevchenko
Quoted 4 lines · Vinod Koul
Quoted 3 lines · Viresh Kumar
Quoted 1 line · Vinod Koul

Never mind, am applying your patches and below fix, let me if you guys are okay

Also, please ensure you _run_ checkpatch. There were few trvial errors in this. I have fixed them up before applying

Quoted 9 lines
Quoted 7 lines
Quoted 2 lines

This information was useful to understand this config option and must be kept in some way.

Well now the config option is not selected by users, so they dont need to know. It was useful in knowing what to select earlier

For documenting, we can add this in commit log or better in driver code where you use this

The driver is better place if you decide to move it (drivers/dma/dw/regs.h).

Okay here it is:

drivers/dma/dw/Kconfig +2 -9
index db2b41f..7be1cf8 100644
@@ -10,6 +10,7 @@ config DW_DMAC_CORE
 config DW_DMAC
 	tristate "Synopsys DesignWare AHB DMA platform driver"
 	select DW_DMAC_CORE
+	select DW_DMAC_BIG_ENDIAN_IO if ARCH=AVR32
 	default y if CPU_AT32AP7000
 	help
 	  Support the Synopsys DesignWare AHB DMA controller. This
@@ -25,12 +26,4 @@ config DW_DMAC_PCI
 	  Intel Medfield has integrated this GPDMA controller.
 
 config DW_DMAC_BIG_ENDIAN_IO
-	bool "Use big endian I/O register access"
-	default y if AVR32
-	depends on DW_DMAC_CORE
-	help
-	  Say yes here to use big endian I/O access when reading and writing
-	  to the DMA controller registers. This is needed on some platforms,
-	  like the Atmel AVR32 architecture.
-
-	  If unsure, use the default setting.
+	bool
drivers/dma/dw/regs.h +6 -0
index 07c5a6e..deb4274 100644
@@ -101,6 +101,12 @@ struct dw_dma_regs {
 	u32	DW_PARAMS;
 };
 
+/*
+ * Big endian I/O access when reading and writing to the DMA controller
+ * registers.  This is needed on some platforms, like the Atmel AVR32
+ * architecture.
+ */
+
 #ifdef CONFIG_DW_DMAC_BIG_ENDIAN_IO
 #define dma_readl_native ioread32be
 #define dma_writel_native iowrite32be

--
~Vinod

#16 lore raw

Re: [PATCH v2 2/4] dma: move dw_dmac driver to an own directory

Quoted 7 lines · Vinod Koul
drivers/dma/dw/regs.h +0 -0
index 07c5a6e..deb4274 100644
@@ -101,6 +101,12 @@ struct dw_dma_regs {
        u32     DW_PARAMS;
 };

drivers/dma/dw/regs.h struct dw_dma_regs { · line 112

Quoted 10 lines
drivers/dma/dw/regs.h +6 -0
 
+/*
+ * Big endian I/O access when reading and writing to the DMA controller
+ * registers.  This is needed on some platforms, like the Atmel AVR32
+ * architecture.
+ */
+
 #ifdef CONFIG_DW_DMAC_BIG_ENDIAN_IO
 #define dma_readl_native ioread32be
 #define dma_writel_native iowrite32be

Looks. Good.

#17 lore raw

Re: [PATCH v2 2/4] dma: move dw_dmac driver to an own directory

In reply to Vinod Koul
Quoted 7 lines · On Wednesday 12 June 2013 14:32:02 Vinod Koul wrote:

config DW_DMAC
tristate "Synopsys DesignWare AHB DMA platform driver" select DW_DMAC_CORE
+ select DW_DMAC_BIG_ENDIAN_IO if ARCH=AVR32
default y if CPU_AT32AP7000
help
Support the Synopsys DesignWare AHB DMA controller. This

I assume you have not actually tested this on AVR32?

The Kconfig statement above compares the values of CONFIG_ARCH and CONFIG_AVR32, so it would turn on big-endian mode when both are disabled (as is normally the case anywhere).

I think what you meant to write is

select DW_DMAC_BIG_ENDIAN_IO if AVR32

Quoted 3 lines · On Wednesday 12 June 2013 13:22:25 Vinod Koul wrote:
Quoted 2 lines

I don't know if we will have any platform in future which has such difference in endianess between CPU and DMA IP block.

you never know what h/w designers would think!

IIRC AVR32 endianess is screwed up in multiple ways and the kernel actually does some extra byte swapping depending on the platform. It's possible that the device is actually doing the regular little-endian I/O there and this is just a workaround from the other swaps. It's certainly best to leave the current logic in place, as your patch does.

Arnd

author reviewer
#18 lore raw

Re: [PATCH v2 2/4] dma: move dw_dmac driver to an own directory

In reply to Vinod Koul

[+ Hein]

Quoted 26 lines · Vinod Koul
Quoted 25 lines · Andy Shevchenko
Quoted 24 lines · Vinod Koul
Quoted 11 lines · Andy Shevchenko

On Wed, Jun 12, 2013 at 10:39 AM, Vinod Koul <[email protected]> wrote:

[]

Quoted 7 lines

Something like
config DW_DMAC_BIG_ENDIAN_IO
tristate

config DW_DMAC
select DW_DMAC_BIG_ENDIAN_IO

Quoted 8 lines
Quoted 3 lines

I belive DW_DMAC is for AVR support and the PCI ones is different right. The point is that these things should be selected by the required symbols based on what ARCH we are on and not be prompted for user to configure via menuconfig

DW_DMAC is a generic platform driver which supports AVR32, ARM and Intel (ACPI case) platforms.

We may do that option invisible to user

Yup

Quoted 3 lines

and then use

Quoted 7 lines
Quoted 6 lines
Quoted 3 lines
Quoted 2 lines

config DW_DMAC
select DW_DMAC_BIG_ENDIAN_IO if ARCH=AVR32

Thats would be the right way

Do you prefer to have this as separate patch or integrated in the split? In my humble opinion I better to do separate patch.

Never mind, am applying your patches and below fix, let me if you guys are okay

As far as I know we have at least one developer (Hein Tibosch) with such board. Let him share his opinion.

Quoted 31 lines
drivers/dma/dw/Kconfig +2 -11
index db2b41f..7be1cf8 100644
@@ -10,6 +10,7 @@ config DW_DMAC_CORE
 config DW_DMAC
 	tristate "Synopsys DesignWare AHB DMA platform driver"
 	select DW_DMAC_CORE
+	select DW_DMAC_BIG_ENDIAN_IO if ARCH=AVR32
 	default y if CPU_AT32AP7000
 	help
 	  Support the Synopsys DesignWare AHB DMA controller. This
@@ -25,12 +26,4 @@ config DW_DMAC_PCI
 	  Intel Medfield has integrated this GPDMA controller.
 
 config DW_DMAC_BIG_ENDIAN_IO
-	bool "Use big endian I/O register access"
-	default y if AVR32
-	depends on DW_DMAC_CORE
-	help
-	  Say yes here to use big endian I/O access when reading and writing
-	  to the DMA controller registers. This is needed on some platforms,
-	  like the Atmel AVR32 architecture.
-
-	  If unsure, use the default setting.
+	bool
-
 
--

~Vinod

Signature · 2 lines
Andy Shevchenko <[email protected]>
Intel Finland Oy
#19 lore raw

Re: [PATCH v2 2/4] dma: move dw_dmac driver to an own directory

Quoted 37 lines · Andy Shevchenko

[+ Hein]

Quoted 22 lines · Vinod Koul
Quoted 21 lines · Andy Shevchenko
Quoted 20 lines · Vinod Koul
Quoted 11 lines · Andy Shevchenko

On Wed, Jun 12, 2013 at 10:39 AM, Vinod Koul <[email protected]> wrote:

[]

Quoted 7 lines

Something like
config DW_DMAC_BIG_ENDIAN_IO
tristate

config DW_DMAC
select DW_DMAC_BIG_ENDIAN_IO

Quoted 7 lines
Quoted 3 lines

I belive DW_DMAC is for AVR support and the PCI ones is different right. The point is that these things should be selected by the required symbols based on what ARCH we are on and not be prompted for user to configure via menuconfig

DW_DMAC is a generic platform driver which supports AVR32, ARM and Intel (ACPI case) platforms.

We may do that option invisible to user

Yup

Quoted 8 lines
Quoted 7 lines
Quoted 5 lines
Quoted 4 lines

and then use

config DW_DMAC
select DW_DMAC_BIG_ENDIAN_IO if ARCH=AVR32

Thats would be the right way

Do you prefer to have this as separate patch or integrated in the split? In my humble opinion I better to do separate patch.

Never mind, am applying your patches and below fix, let me if you guys are okay

As far as I know we have at least one developer (Hein Tibosch) with such board. Let him share his opinion.

Quoted 9 lines

drivers/dma/dw/Kconfig config DW_DMAC_CORE · line 13

Quoted 9 lines
drivers/dma/dw/Kconfig +1 -0
index db2b41f..7be1cf8 100644
@@ -10,6 +10,7 @@ config DW_DMAC_CORE
 config DW_DMAC
 	tristate "Synopsys DesignWare AHB DMA platform driver"
 	select DW_DMAC_CORE
+	select DW_DMAC_BIG_ENDIAN_IO if ARCH=AVR32

Yes sure! Avr32 users won't have any other choice as to select this option.

Hein

Quoted 21 lines
Quoted 21 lines
drivers/dma/dw/Kconfig +1 -11
 	default y if CPU_AT32AP7000
 	help
 	  Support the Synopsys DesignWare AHB DMA controller. This
@@ -25,12 +26,4 @@ config DW_DMAC_PCI
 	  Intel Medfield has integrated this GPDMA controller.
 
 config DW_DMAC_BIG_ENDIAN_IO
-	bool "Use big endian I/O register access"
-	default y if AVR32
-	depends on DW_DMAC_CORE
-	help
-	  Say yes here to use big endian I/O access when reading and writing
-	  to the DMA controller registers. This is needed on some platforms,
-	  like the Atmel AVR32 architecture.
-
-	  If unsure, use the default setting.
+	bool
-
 
--

~Vinod

author reviewer
#20 lore raw

PATCH v2 3/4 dma: dw: split driver to library part and platform code

In reply to Andy Shevchenko

To simplify the driver development let's split driver to library and platform code parts. It helps us to add PCI driver in future.

---
 drivers/dma/Makefile                      |   2 +-
 drivers/dma/dw/Kconfig                    |   8 +-
 drivers/dma/dw/Makefile                   |   6 +-
 drivers/dma/dw/{dw_dmac.c => core.c}      | 311 ++++-------------------------
 drivers/dma/dw/internal.h                 |  70 +++++++
 drivers/dma/dw/platform.c                 | 317 ++++++++++++++++++++++++++++++
 drivers/dma/dw/{dw_dmac_regs.h => regs.h} |   1 +
 7 files changed, 436 insertions(+), 279 deletions(-)
 rename drivers/dma/dw/{dw_dmac.c => core.c} (85%)
 create mode 100644 drivers/dma/dw/internal.h
 create mode 100644 drivers/dma/dw/platform.c
 rename drivers/dma/dw/{dw_dmac_regs.h => regs.h} (99%)
drivers/dma/Makefile +1 -1
index ac44ca0..6e2a521 100644
@@ -15,7 +15,7 @@ obj-$(CONFIG_FSL_DMA) += fsldma.o
 obj-$(CONFIG_MPC512X_DMA) += mpc512x_dma.o
 obj-$(CONFIG_PPC_BESTCOMM) += bestcomm/
 obj-$(CONFIG_MV_XOR) += mv_xor.o
-obj-$(CONFIG_DW_DMAC) += dw/
+obj-$(CONFIG_DW_DMAC_CORE) += dw/
 obj-$(CONFIG_AT_HDMAC) += at_hdmac.o
 obj-$(CONFIG_MX3_IPU) += ipu/
 obj-$(CONFIG_TXX9_DMAC) += txx9dmac.o
drivers/dma/dw/Kconfig +6 -2
index 38a215a..efd9e02 100644
@@ -2,10 +2,14 @@
 # DMA engine configuration for dw
 #
 
-config DW_DMAC
+config DW_DMAC_CORE
 	tristate "Synopsys DesignWare AHB DMA support"
 	depends on GENERIC_HARDIRQS
 	select DMA_ENGINE
+
+config DW_DMAC
+	tristate "Synopsys DesignWare AHB DMA platform driver"
+	select DW_DMAC_CORE
 	default y if CPU_AT32AP7000
 	help
 	  Support the Synopsys DesignWare AHB DMA controller. This
@@ -14,7 +18,7 @@ config DW_DMAC
 config DW_DMAC_BIG_ENDIAN_IO
 	bool "Use big endian I/O register access"
 	default y if AVR32
-	depends on DW_DMAC
+	depends on DW_DMAC_CORE
 	help
 	  Say yes here to use big endian I/O access when reading and writing
 	  to the DMA controller registers. This is needed on some platforms,
drivers/dma/dw/Makefile +5 -1
index dd8d993..47f3674 100644
@@ -1 +1,5 @@
-obj-$(CONFIG_DW_DMAC) += dw_dmac.o
+obj-$(CONFIG_DW_DMAC_CORE)	+= dw_dmac_core.o
+dw_dmac_core-objs	:= core.o
+
+obj-$(CONFIG_DW_DMAC)		+= dw_dmac.o
+dw_dmac-objs		:= platform.o
drivers/dma/dw/core.c renamed from drivers/dma/dw/dw_dmac.c +36 -275

446 lines not on this page · raw message

drivers/dma/dw/internal.h new file +70 -0

70 lines not on this page · raw message

drivers/dma/dw/platform.c new file +317 -0

317 lines not on this page · raw message

drivers/dma/dw/regs.h renamed from drivers/dma/dw/dw_dmac_regs.h +1 -0
similarity index 99%
rename from drivers/dma/dw/dw_dmac_regs.h
rename to drivers/dma/dw/regs.h
index 9d41720..07c5a6e 100644
@@ -9,6 +9,7 @@
  * published by the Free Software Foundation.
  */
 
+#include <linux/interrupt.h>
 #include <linux/dmaengine.h>
 #include <linux/dw_dmac.h>
 
Signature · 1 line
1.8.2.rc0.22.gb3600c3
author reviewer
#21 lore raw

PATCH v2 4/4 dma: dw: add PCI part of the driver

In reply to Andy Shevchenko

This is the PCI part of the DesignWare DMAC driver. The controller is usually used in the Intel hardware such as Intel Medfield.

---
 drivers/dma/dw/Kconfig  |   9 +++++
 drivers/dma/dw/Makefile |   3 ++
 drivers/dma/dw/pci.c    | 101 ++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 113 insertions(+)
 create mode 100644 drivers/dma/dw/pci.c
drivers/dma/dw/Kconfig +9 -0
index efd9e02..db2b41f 100644
@@ -15,6 +15,15 @@ config DW_DMAC
 	  Support the Synopsys DesignWare AHB DMA controller. This
 	  can be integrated in chips such as the Atmel AT32ap7000.
 
+config DW_DMAC_PCI
+	tristate "Synopsys DesignWare AHB DMA PCI driver"
+	depends on PCI
+	select DW_DMAC_CORE
+	help
+	  Support the Synopsys DesignWare AHB DMA controller on the
+	  platfroms that enumerate it as a PCI device. For example,
+	  Intel Medfield has integrated this GPDMA controller.
+
 config DW_DMAC_BIG_ENDIAN_IO
 	bool "Use big endian I/O register access"
 	default y if AVR32
drivers/dma/dw/Makefile +3 -0
index 47f3674..3eebd1c 100644
@@ -3,3 +3,6 @@ dw_dmac_core-objs	:= core.o
 
 obj-$(CONFIG_DW_DMAC)		+= dw_dmac.o
 dw_dmac-objs		:= platform.o
+
+obj-$(CONFIG_DW_DMAC_PCI)	+= dw_dmac_pci.o
+dw_dmac_pci-objs	:= pci.o
drivers/dma/dw/pci.c new file +101 -0

101 lines not on this page · raw message

Signature · 1 line
1.8.2.rc0.22.gb3600c3
author reviewer
#22 lore raw
In reply to Andy Shevchenko
Quoted 17 lines · Andy Shevchenko

This is split of the dw_dmac driver as suggested by Arnd et al [1,2]. There are three most important patches:
2/4 moves driver to its own folder
3/4 does the actual split
4/4 introduces PCI part of the driver

During this files are renamed: mostly means that dw_dmac prefix is eliminated. I hope to get it ready to be included in v3.11.

[1] http://www.spinics.net/lists/kernel/msg1408174.html
[2] http://www.spinics.net/lists/kernel/msg1408495.html

Changes v1->v2:
- address Arnd's comments
- compile test when !CONFIG_PM
- apply ACKs

Quoted 6 lines

Cnages v0->v1:
- apply Viresh's ACKs
- append PCI part of the driver
- test altogether on Intel Medfield
- add 1/4 to the series as it based on it, but Vinod didn't apply it yet to his tree.

Vinod, do you have any comments on this?

We would like to have this scheduled for v3.11.
I think we still have few days if you think we need to improve this patchset.

Signature · 2 lines
Andy Shevchenko <[email protected]>
Intel Finland Oy
#23 lore raw
Quoted 18 lines · Andy Shevchenko
Quoted 17 lines · Andy Shevchenko

This is split of the dw_dmac driver as suggested by Arnd et al [1,2]. There are three most important patches:
2/4 moves driver to its own folder
3/4 does the actual split
4/4 introduces PCI part of the driver

During this files are renamed: mostly means that dw_dmac prefix is eliminated. I hope to get it ready to be included in v3.11.

[1] http://www.spinics.net/lists/kernel/msg1408174.html
[2] http://www.spinics.net/lists/kernel/msg1408495.html

Changes v1->v2:
- address Arnd's comments
- compile test when !CONFIG_PM
- apply ACKs

Quoted 8 lines
Quoted 6 lines

Cnages v0->v1:
- apply Viresh's ACKs
- append PCI part of the driver
- test altogether on Intel Medfield
- add 1/4 to the series as it based on it, but Vinod didn't apply it yet to his tree.

Vinod, do you have any comments on this?

Looks good, just a minor nitpcik on 2nd one...

Quoted 4 lines

We would like to have this scheduled for v3.11.
I think we still have few days if you think we need to improve this patchset.

Sure,...

--
~Vinod