Skip to contentSkip to conversation

new Atmel DMA controller

PATCH Superseded Ludovic Desroches 3 participants 9 messages Oct 22, 2014 – Nov 19, 2014

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

v7 cover new Atmel DMA controller

Hi,

This set of patches introduces support for the new Atmel DMA controller know as XDMAC and available on SAMA5D4.

Changes from:
- v6
- change binding: merge the two dma-cells
- no more use direction in slave config
- remove cookie init
- return an error on a bad maxburst value
- v5
- fix a bug when doing memcpy, condition to set the NDE was inverted
- replace irqsave locks by bh variant
- unmask channel errors
- v4
- compile the driver if COMPILE_TEST is selected
- merge header file into at_xdmac.c
- use write memory barriers before starting the channel
- init active_xfer to false when taking a descriptor from the free descriptors list
- remove dma capabilities mask
- use CONFIG_PM instead of CONFIG_PM_SLEEP for prepare function
- style fixes
- update documentation to add the <chip> compatible description
- v3
- use dma_get_any_slave_channel instead of dma_request_channel
- fix tx_status behavior for non active transfers
- rename at_xdmac_terminate_xfer
- replace suspend/resume no irq variants by late/early variants
- no more use dev res to request the irq, use the legacy way
- add slave capabilities
- v2
- documentation updated
- fix locking issues
- v1
- add power management stuff
- check maxburst value
- revert subsys_initcall remove, EPROBE_DEFER not yet available on the kernel version I use to do the tests, moreover other devices are not ready to use it
- RFC:
- DMA_SUCCESS replaced by DMA_COMPLETE
- fix memcpy issue caused by a mistake in interfaces used
- add filter function
- remove some parameters from device tree since we can get them through the dma slave configuration
- use readl/writel relaxed
- remove subsys_initcall
- synchronize irq before killing tasklets
- use BIT macro
- misc cleanup

Ludovic Desroches (3):
dma: at_xdmac: creation of the atmel eXtended DMA Controller driver
ARM: dts: at_xdmac: add bindings documentation
MAINTAINERS: add entry for Atmel XDMA driver

 .../devicetree/bindings/dma/atmel-xdma.txt         |   54 +
 MAINTAINERS                                        |    7 +
 drivers/dma/Kconfig                                |    7 +
 drivers/dma/Makefile                               |    1 +
 drivers/dma/at_xdmac.c                             | 1510 ++++++++++++++++++++
 include/dt-bindings/dma/at91.h                     |   25 +
 6 files changed, 1604 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/dma/atmel-xdma.txt
 create mode 100644 drivers/dma/at_xdmac.c
Signature · 1 line
2.0.3
#1 lore raw

PATCH v7 1/3 dma: at_xdmac: creation of the atmel eXtended DMA Controller driver

New atmel DMA controller known as XDMAC, introduced with SAMA5D4 devices.

---
 drivers/dma/Kconfig            |    7 +
 drivers/dma/Makefile           |    1 +
 drivers/dma/at_xdmac.c         | 1510 ++++++++++++++++++++++++++++++++++++++++
 include/dt-bindings/dma/at91.h |   25 +
 4 files changed, 1543 insertions(+)
 create mode 100644 drivers/dma/at_xdmac.c
drivers/dma/Kconfig +7 -0
index de46982..607271a 100644
@@ -107,6 +107,13 @@ config AT_HDMAC
 	help
 	  Support the Atmel AHB DMA controller.
 
+config AT_XDMAC
+	tristate "Atmel XDMA support"
+	depends on (ARCH_AT91 || COMPILE_TEST)
+	select DMA_ENGINE
+	help
+	  Support the Atmel XDMA controller.
+
 config FSL_DMA
 	tristate "Freescale Elo series DMA support"
 	depends on FSL_SOC
drivers/dma/Makefile +1 -0
index cb626c1..2022b54 100644
@@ -16,6 +16,7 @@ obj-$(CONFIG_PPC_BESTCOMM) += bestcomm/
 obj-$(CONFIG_MV_XOR) += mv_xor.o
 obj-$(CONFIG_DW_DMAC_CORE) += dw/
 obj-$(CONFIG_AT_HDMAC) += at_hdmac.o
+obj-$(CONFIG_AT_XDMAC) += at_xdmac.o
 obj-$(CONFIG_MX3_IPU) += ipu/
 obj-$(CONFIG_TXX9_DMAC) += txx9dmac.o
 obj-$(CONFIG_SH_DMAE_BASE) += sh/
drivers/dma/at_xdmac.c new file +1510 -0

1,510 lines not on this page · raw message

include/dt-bindings/dma/at91.h +25 -0
index e835037..ab6cbba 100644
@@ -9,6 +9,8 @@
 #ifndef __DT_BINDINGS_AT91_DMA_H__
 #define __DT_BINDINGS_AT91_DMA_H__
 
+/* ---------- HDMAC ---------- */
+
 /*
  * Source and/or destination peripheral ID
  */
@@ -24,4 +26,27 @@
 #define AT91_DMA_CFG_FIFOCFG_ALAP	(0x1 << AT91_DMA_CFG_FIFOCFG_OFFSET)	/* largest defined AHB burst */
 #define AT91_DMA_CFG_FIFOCFG_ASAP	(0x2 << AT91_DMA_CFG_FIFOCFG_OFFSET)	/* single AHB access */
 
+
+/* ---------- XDMAC ---------- */
+#define AT91_XDMAC_DT_MEM_IF_MASK	(0x1)
+#define AT91_XDMAC_DT_MEM_IF_OFFSET	(13)
+#define AT91_XDMAC_DT_MEM_IF(mem_if)	(((mem_if) & AT91_XDMAC_DT_MEM_IF_MASK) \
+					<< AT91_XDMAC_DT_MEM_IF_OFFSET)
+#define AT91_XDMAC_DT_GET_MEM_IF(cfg)	(((cfg) >> AT91_XDMAC_DT_MEM_IF_OFFSET) \
+					& AT91_XDMAC_DT_MEM_IF_MASK)
+
+#define AT91_XDMAC_DT_PER_IF_MASK	(0x1)
+#define AT91_XDMAC_DT_PER_IF_OFFSET	(14)
+#define AT91_XDMAC_DT_PER_IF(per_if)	(((per_if) & AT91_XDMAC_DT_PER_IF_MASK) \
+					<< AT91_XDMAC_DT_PER_IF_OFFSET)
+#define AT91_XDMAC_DT_GET_PER_IF(cfg)	(((cfg) >> AT91_XDMAC_DT_PER_IF_OFFSET) \
+					& AT91_XDMAC_DT_PER_IF_MASK)
+
+#define AT91_XDMAC_DT_PERID_MASK	(0x7f)
+#define AT91_XDMAC_DT_PERID_OFFSET	(24)
+#define AT91_XDMAC_DT_PERID(perid)	(((perid) & AT91_XDMAC_DT_PERID_MASK) \
+					<< AT91_XDMAC_DT_PERID_OFFSET)
+#define AT91_XDMAC_DT_GET_PERID(cfg)	(((cfg) >> AT91_XDMAC_DT_PERID_OFFSET) \
+					& AT91_XDMAC_DT_PERID_MASK)
+
 #endif /* __DT_BINDINGS_AT91_DMA_H__ */
Signature · 1 line
2.0.3
#2 lore raw

PATCH v7 2/3 ARM: dts: at_xdmac: add bindings documentation

In reply to Ludovic Desroches

Add bindings documentation for the new Atmel DMA controller (XDMAC) introduced with SAMA5D4.

---
 .../devicetree/bindings/dma/atmel-xdma.txt         | 54 ++++++++++++++++++++++
 1 file changed, 54 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/dma/atmel-xdma.txt
Documentation/devicetree/bindings/dma/atmel-xdma.txt new file +54 -0
new file mode 100644
index 0000000..e75c128
@@ -0,0 +1,54 @@
+* Atmel Extensible Direct Memory Access Controller (XDMAC)
+
+* XDMA Controller
+Required properties:
+- compatible: Should be "atmel,<chip>-dma".
+  <chip> compatible description:
+  - sama5d4: first SoC adding the XDMAC
+- reg: Should contain DMA registers location and length.
+- interrupts: Should contain DMA interrupt.
+- #dma-cells: Must be <1>, used to represent the number of integer cells in
+the dmas property of client devices.
+  - The 1st cell specifies the channel configuration register:
+    - bit 13: SIF, source interface identifier, used to get the memory
+    interface identifier,
+    - bit 14: DIF, destination interface identifier, used to get the peripheral
+    interface identifier,
+    - bit 30-24: PERID, peripheral identifier.
+
+Example:
+
+dma1: dma-controller at f0004000 {
+	compatible = "atmel,sama5d4-dma";
+	reg = <0xf0004000 0x200>;
+	interrupts = <50 4 0>;
+	#dma-cells = <2>;
+};
+
+
+* DMA clients
+DMA clients connected to the Atmel XDMA controller must use the format
+described in the dma.txt file, using a one-cell specifier for each channel.
+The two cells in order are:
+1. A phandle pointing to the DMA controller.
+2. Channel configuration register. Configurable fields are:
+    - bit 13: SIF, source interface identifier, used to get the memory
+    interface identifier,
+    - bit 14: DIF, destination interface identifier, used to get the peripheral
+    interface identifier,
+  - bit 30-24: PERID, peripheral identifier.
+
+Example:
+
+i2c2: i2c at f8024000 {
+	compatible = "atmel,at91sam9x5-i2c";
+	reg = <0xf8024000 0x4000>;
+	interrupts = <34 4 6>;
+	dmas = <&dma1
+		(AT91_XDMAC_DT_MEM_IF(0) | AT91_XDMAC_DT_PER_IF(1)
+		 | AT91_XDMAC_DT_PERID(6))>,
+	       <&dma1
+		(AT91_XDMAC_DT_MEM_IF(0) | AT91_XDMAC_DT_PER_IF(1)
+		| AT91_XDMAC_DT_PERID(7))>;
+	dma-names = "tx", "rx";
+};
Signature · 1 line
2.0.3
#3 lore raw

PATCH v7 3/3 MAINTAINERS: add entry for Atmel XDMA driver

In reply to Ludovic Desroches
---
 MAINTAINERS | 7 +++++++
 1 file changed, 7 insertions(+)
MAINTAINERS +7 -0
index bc69ca4..74db724 100644
@@ -1713,6 +1713,13 @@ F:	drivers/dma/at_hdmac.c
 F:	drivers/dma/at_hdmac_regs.h
 F:	include/linux/platform_data/dma-atmel.h
 
+ATMEL XDMA DRIVER
+M:	Ludovic Desroches <[email protected]>
+L:	linux-arm-kernel at lists.infradead.org
+L:	dmaengine at vger.kernel.org
+S:	Supported
+F:	drivers/dma/at_xdmac.c
+
 ATMEL I2C DRIVER
 M:	Ludovic Desroches <[email protected]>
 L:	linux-i2c at vger.kernel.org
Signature · 1 line
2.0.3
#4 lore raw

v7 cover new Atmel DMA controller

In reply to Ludovic Desroches

Hi Vinod,

Does this new version meet your expectations? I would not like to delay xdma inclusion to 3.20 because we still have no DMA on sama5d4, that is not very convenient.

Regards

Ludovic

Quoted 71 lines · Ludovic Desroches

Hi,

This set of patches introduces support for the new Atmel DMA controller know as XDMAC and available on SAMA5D4.

Changes from:
- v6
- change binding: merge the two dma-cells
- no more use direction in slave config
- remove cookie init
- return an error on a bad maxburst value
- v5
- fix a bug when doing memcpy, condition to set the NDE was inverted
- replace irqsave locks by bh variant
- unmask channel errors
- v4
- compile the driver if COMPILE_TEST is selected
- merge header file into at_xdmac.c
- use write memory barriers before starting the channel
- init active_xfer to false when taking a descriptor from the free descriptors list
- remove dma capabilities mask
- use CONFIG_PM instead of CONFIG_PM_SLEEP for prepare function
- style fixes
- update documentation to add the <chip> compatible description
- v3
- use dma_get_any_slave_channel instead of dma_request_channel
- fix tx_status behavior for non active transfers
- rename at_xdmac_terminate_xfer
- replace suspend/resume no irq variants by late/early variants
- no more use dev res to request the irq, use the legacy way
- add slave capabilities
- v2
- documentation updated
- fix locking issues
- v1
- add power management stuff
- check maxburst value
- revert subsys_initcall remove, EPROBE_DEFER not yet available on the kernel version I use to do the tests, moreover other devices are not ready to use it
- RFC:
- DMA_SUCCESS replaced by DMA_COMPLETE
- fix memcpy issue caused by a mistake in interfaces used
- add filter function
- remove some parameters from device tree since we can get them through the dma slave configuration
- use readl/writel relaxed
- remove subsys_initcall
- synchronize irq before killing tasklets
- use BIT macro
- misc cleanup

Ludovic Desroches (3):
dma: at_xdmac: creation of the atmel eXtended DMA Controller driver
ARM: dts: at_xdmac: add bindings documentation
MAINTAINERS: add entry for Atmel XDMA driver

 .../devicetree/bindings/dma/atmel-xdma.txt         |   54 +
 MAINTAINERS                                        |    7 +
 drivers/dma/Kconfig                                |    7 +
 drivers/dma/Makefile                               |    1 +
 drivers/dma/at_xdmac.c                             | 1510 ++++++++++++++++++++
 include/dt-bindings/dma/at91.h                     |   25 +
 6 files changed, 1604 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/dma/atmel-xdma.txt
 create mode 100644 drivers/dma/at_xdmac.c
Signature · 1 line
2.0.3
Applied
#5 lore raw

v7 cover new Atmel DMA controller

In reply to Ludovic Desroches
Quoted 4 lines · Ludovic Desroches

Hi,

This set of patches introduces support for the new Atmel DMA controller know as XDMAC and available on SAMA5D4.

Applied all, thanks

Signature · 1 line
~Vinod
#6 lore raw

v7 cover new Atmel DMA controller

On 06/11/2014 06:27, Vinod Koul :

Quoted 7 lines · Ludovic Desroches
Quoted 4 lines

Hi,

This set of patches introduces support for the new Atmel DMA controller know as XDMAC and available on SAMA5D4.

Applied all, thanks

Vinod,

I saw that you had created a topic branch for this driver: topic/at_xdmac.

If this branch is stable, can I use it for my work on at91 support and merge it in my at91-3.19-dt branch before sending it to the arm-soc tree? In fact I need the binding definitions that are created by the patch:(dmaengine: at_xdmac: creation of the atmel eXtended DMA Controller driver).

Thanks, bye,

Signature · 1 line
Nicolas Ferre
#7 lore raw

v7 cover new Atmel DMA controller

Quoted 11 lines · Nicolas Ferre

On 06/11/2014 06:27, Vinod Koul :

Quoted 7 lines · Ludovic Desroches
Quoted 4 lines

Hi,

This set of patches introduces support for the new Atmel DMA controller know as XDMAC and available on SAMA5D4.

Applied all, thanks

Vinod,

Quoted 7 lines

I saw that you had created a topic branch for this driver: topic/at_xdmac.

If this branch is stable, can I use it for my work on at91 support and merge it in my at91-3.19-dt branch before sending it to the arm-soc tree? In fact I need the binding definitions that are created by the patch:(dmaengine: at_xdmac: creation of the atmel eXtended DMA Controller driver).

Yup please pull this, this wont be rebased

Thanks

Signature · 1 line
~Vinod
#8 lore raw

v7 cover new Atmel DMA controller

On 19/11/2014 12:07, Vinod Koul :

Quoted 12 lines · Nicolas Ferre
Quoted 11 lines

On 06/11/2014 06:27, Vinod Koul :

Quoted 7 lines · Ludovic Desroches
Quoted 4 lines

Hi,

This set of patches introduces support for the new Atmel DMA controller know as XDMAC and available on SAMA5D4.

Applied all, thanks

Vinod,

Quoted 8 lines
Quoted 7 lines

I saw that you had created a topic branch for this driver: topic/at_xdmac.

If this branch is stable, can I use it for my work on at91 support and merge it in my at91-3.19-dt branch before sending it to the arm-soc tree? In fact I need the binding definitions that are created by the patch:(dmaengine: at_xdmac: creation of the atmel eXtended DMA Controller driver).

Yup please pull this, this wont be rebased

Thanks for your blazing fast answer Vinod. My pull-request is sent now.

Bye,

Signature · 1 line
Nicolas Ferre