Skip to contentSkip to conversation

dw_dmac: move to own folder and split

RFC PATCH In review Andy Shevchenko 2 participants 10 messages May 31, 2013 – Jun 3, 2013

Subsystems (2)
lore
Share & tools
lore

Andy Shevchenko

author reviewer
#0 lore raw

cover dw_dmac: move to own folder and split

This is first attempt to do split as suggested by Arnd et al. First patch moves driver to its own folder.
Second one does the actual split.

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.

Andy Shevchenko (2):
dma: move dw_dmac driver to an own directory
dma: dw: split driver to library part and platform code

 MAINTAINERS                               |   3 +-
 drivers/dma/Kconfig                       |  20 +-
 drivers/dma/Makefile                      |   2 +-
 drivers/dma/dw/Kconfig                    |  27 +++
 drivers/dma/dw/Makefile                   |   5 +
 drivers/dma/{dw_dmac.c => dw/core.c}      | 301 ++++-------------------------
 drivers/dma/dw/internal.h                 |  50 +++++
 drivers/dma/dw/platform.c                 | 306 ++++++++++++++++++++++++++++++
 drivers/dma/{dw_dmac_regs.h => dw/regs.h} |   1 +
 9 files changed, 426 insertions(+), 289 deletions(-)
 create mode 100644 drivers/dma/dw/Kconfig
 create mode 100644 drivers/dma/dw/Makefile
 rename drivers/dma/{dw_dmac.c => dw/core.c} (86%)
 create mode 100644 drivers/dma/dw/internal.h
 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

RFC PATCH 1/2 dma: move dw_dmac driver to an own directory

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 fdd0544..0b24126 100644
@@ -6991,8 +6991,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
#2 lore raw

Re: [RFC PATCH v0 1/2] dma: move dw_dmac driver to an own directory

drivers/dma/Makefile

Quoted 5 lines · Andy Shevchenko
drivers/dma/Makefile +3 -0
+obj-$(CONFIG_DW_DMAC) += dw/
 
+++ b/drivers/dma/dw/Makefile
+obj-$(CONFIG_DW_DMAC) += dw_dmac.o

The lower one should be obj-y += dw_dmac.o as this will always be true.

author reviewer
#3 lore raw

Re: [RFC PATCH v0 1/2] dma: move dw_dmac driver to an own directory

Quoted 9 lines · Viresh Kumar

drivers/dma/Makefile

Quoted 5 lines · Andy Shevchenko
drivers/dma/Makefile +3 -0
+obj-$(CONFIG_DW_DMAC) += dw/
 
+++ b/drivers/dma/dw/Makefile
+obj-$(CONFIG_DW_DMAC) += dw_dmac.o

The lower one should be obj-y += dw_dmac.o as this will always be true.

Imagine the case when we choose platform driver to be compiled as a module. It means both variables set to m.

During compilation we will have core part compiled-in, and platform part as a module.

I don't think this is what we want.

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

Re: [RFC PATCH v0 1/2] dma: move dw_dmac driver to an own directory

Quoted 7 lines · Andy Shevchenko

Imagine the case when we choose platform driver to be compiled as a module. It means both variables set to m.

During compilation we will have core part compiled-in, and platform part as a module.

I don't think this is what we want.

Correct. So, both are acked without any more comments :)

author reviewer
#5 lore raw

RFC PATCH 2/2 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}      | 299 ++++-------------------------
 drivers/dma/dw/internal.h                 |  50 +++++
 drivers/dma/dw/platform.c                 | 306 ++++++++++++++++++++++++++++++
 drivers/dma/dw/{dw_dmac_regs.h => regs.h} |   1 +
 7 files changed, 402 insertions(+), 270 deletions(-)
 rename drivers/dma/dw/{dw_dmac.c => core.c} (86%)
 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 +33 -266

427 lines not on this page · raw message

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

50 lines not on this page · raw message

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

306 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
Acked-by on the v0 series
#6 lore raw
In reply to Andy Shevchenko
Quoted 6 lines · Andy Shevchenko

This is first attempt to do split as suggested by Arnd et al. First patch moves driver to its own folder.
Second one does the actual split.

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.

Couldn't find any obvious mistake in your patch other than minor comment on 1/2 (it stays valid for 2/2 as well)..

author reviewer
#7 lore raw
Quoted 9 lines · Viresh Kumar
Quoted 6 lines · Andy Shevchenko

This is first attempt to do split as suggested by Arnd et al. First patch moves driver to its own folder.
Second one does the actual split.

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.

Thanks for review.

I still have doubts about few things.

I did renaming twice, first time it's actually moving to folder and keeping the same file names, and second time when I split driver. Might be better to do this in first patch? My logic here is to distinguish just moving, that's why I kept names.

In patch 2/2 I collect platform related code. I see a lot of #ifdefs related to OF and ACPI. I would like to split it further and create files like of.c and acpi.c. What do you think?

Last thing, I would like to prepare PCI driver (which is not ready yet in new shape) and see how it will go with this split.

And I forgot to mention that patch series relies on the patch I sent before (clean up for devm_ioremap_resources) and Vinod didn't apply yet.

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

I still have doubts about few things.

I did renaming twice, first time it's actually moving to folder and keeping the same file names, and second time when I split driver. Might be better to do this in first patch? My logic here is to distinguish just moving, that's why I kept names.

What you did is absolutely correct and renaming makes more sense in 2/2.

Quoted 3 lines

In patch 2/2 I collect platform related code. I see a lot of #ifdefs related to OF and ACPI. I would like to split it further and create files like of.c and acpi.c. What do you think?

Naahh.. OF by itself doesn't mean anything here on this driver. It belongs to all the users that are using DT to enumerate it (Mostly ARM). And they are going to use platform_driver interface. So, code is well located currently too..

ACPI, I am not sure.. you need these routines in your pci stuff too? Keep it this way:
- Keep all the common stuff across pci and platform in core.c
- everything else in pci and platform files.

Quoted 2 lines

And I forgot to mention that patch series relies on the patch I sent before (clean up for devm_ioremap_resources) and Vinod didn't apply yet.

I understood it when I tried to apply it at my end :)

author reviewer
#9 lore raw
Quoted 11 lines · Viresh Kumar
Quoted 3 lines · Andy Shevchenko

In patch 2/2 I collect platform related code. I see a lot of #ifdefs related to OF and ACPI. I would like to split it further and create files like of.c and acpi.c. What do you think?

Naahh.. OF by itself doesn't mean anything here on this driver. It belongs to all the users that are using DT to enumerate it (Mostly ARM). And they are going to use platform_driver interface. So, code is well located currently too..

I got it.

Quoted 1 line

ACPI, I am not sure.. you need these routines in your pci stuff too?

No, ACPI is alike OF, it relies on platform driver.

Quoted 3 lines

Keep it this way:
- Keep all the common stuff across pci and platform in core.c
- everything else in pci and platform files.

It seems it's kept in that way already.

Thanks for your comments!

I will resend patch series v1 w/o RFC and with PCI driver later (when it will be ready). I will attach the missed patch to the series in case Vinod doesn't apply it in time.

Signature · 2 lines
Andy Shevchenko <[email protected]>
Intel Finland Oy