Skip to contentSkip to conversation

DMA Engine support for AM33xx

RFC PATCH Superseded Matt Porter 9 participants 52 messages Sep 20, 2012 – Oct 9, 2012

Subsystems (11)

v1 of 9 Superseded Latest is v9 →

lore
Share & tools
lore
#0 lore raw

cover DMA Engine support for AM33xx

This series adds DMA Engine support for AM33xx, which uses an EDMA DMAC. The EDMA DMAC has been previously supported by only a private API implementation (much like the situation with OMAP DMA) found on the DaVinci family of SoCs.

There are a mind-boggling number of dependencies for this series:

- Jon Hunter's OF DMA helpers series
https://patchwork.kernel.org/patch/1461061/
https://patchwork.kernel.org/patch/1461051/
- Patch to address OF DMA helpers naming issues:
https://patchwork.kernel.org/patch/1477921/
- EDMA DMA Engine wrapper driver in linux-next c2dde5f8f2095d7c623ff3565c1462e190272273
- EDMA DMA Engine wrapper driver bug fix:
https://patchwork.kernel.org/patch/1474411/
- A huge number of patches in linux-next for AM33xx boot (too numerous to list)

The approach taken is similar to how OMAP DMA is being converted to DMA Engine support. With the functional EDMA private API already existing in mach-davinci/dma.c, we first move that to an ARM common area so it can be shared. Adding DT and runtime PM support to the private EDMA API implementation allows it to run on AM33xx. AM33xx *only* boots using DT so we leverage Jon's generic DT DMA helpers to register EDMA DMAC with the of_dma framework and then add support for calling the dma_request_slave_channel() API to both the mmc and spi drivers.

What works? Well, with this series we now have MMC and SPI support on AM33xx. The only caveat for MMC is that the mmc3 controller has its events on the crossbar and is not usable right now.

This is tested on BeagleBone with a SPI framebuffer driver and SD card.

After this series, the plan is to convert the last in-tree user of the private EDMA API (davinci-pcm/mcasp) and then eliminate the private EDMA API by folding its functionality into drivers/dma/edma.c.

TODO:
add AM33xx crossbar support to the private EDMA API (any EDMA events on the crossbar are not supported)

Matt Porter (13):
ARM: davinci: move private EDMA API to arm/common
ARM: edma: remove unused transfer controller handlers
ARM: edma: add DT and runtime PM support for AM335x
dmaengine: edma: enable build for AM335x
dma: Add TI EDMA device tree binding
ARM: omap: add hsmmc am33xx specific init
mmc: omap_hsmmc: dma_request_slave_channel() support for DT platforms
mmc: omap_hsmmc: limit max_segs with the EDMA DMAC
mmc: omap_hsmmc: add generic DMA request support to the DT binding
spi: omap2-mcspi: dma_request_slave_channel() support for DT
platforms
spi: omap2-mcspi: add generic DMA request support to the DT binding
ARM: dts: add am33xx EDMA support
Documentation: add schedule for removing private EDMA API

 Documentation/devicetree/bindings/dma/ti-edma.txt  |   49 +
 .../devicetree/bindings/mmc/ti-omap-hsmmc.txt      |   25 +-
 Documentation/devicetree/bindings/spi/omap-spi.txt |   27 +-
 Documentation/feature-removal-schedule.txt         |   10 +
 arch/arm/Kconfig                                   |    1 +
 arch/arm/boot/dts/am33xx.dtsi                      |   46 +
 arch/arm/common/Kconfig                            |    3 +
 arch/arm/common/Makefile                           |    1 +
 arch/arm/common/edma.c                             | 1779 ++++++++++++++++++++
 arch/arm/include/asm/mach/edma.h                   |  267 +++
 arch/arm/mach-davinci/Makefile                     |    2 +-
 arch/arm/mach-davinci/devices.c                    |    3 +-
 arch/arm/mach-davinci/dm355.c                      |    2 +-
 arch/arm/mach-davinci/dm365.c                      |    2 +-
 arch/arm/mach-davinci/dm644x.c                     |    2 +-
 arch/arm/mach-davinci/dm646x.c                     |    2 +-
 arch/arm/mach-davinci/dma.c                        | 1588 -----------------
 arch/arm/mach-davinci/include/mach/asp.h           |    2 +-
 arch/arm/mach-davinci/include/mach/da8xx.h         |    3 +-
 arch/arm/mach-davinci/include/mach/edma.h          |  267 ---
 arch/arm/mach-davinci/include/mach/spi.h           |    2 +-
 arch/arm/mach-omap2/hsmmc.c                        |    7 +-
 arch/arm/plat-omap/Kconfig                         |    1 +
 drivers/dma/Kconfig                                |    2 +-
 drivers/dma/edma.c                                 |    2 +-
 drivers/mmc/host/omap_hsmmc.c                      |   26 +-
 drivers/spi/spi-omap2-mcspi.c                      |   68 +-
 27 files changed, 2296 insertions(+), 1893 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/dma/ti-edma.txt
 create mode 100644 arch/arm/common/edma.c
 create mode 100644 arch/arm/include/asm/mach/edma.h
 delete mode 100644 arch/arm/mach-davinci/dma.c
 delete mode 100644 arch/arm/mach-davinci/include/mach/edma.h
Signature · 1 line
1.7.9.5
#1 lore raw

RFC PATCH 1/13 ARM: davinci: move private EDMA API to arm/common

Move mach-davinci/dma.c to common/edma.c so it can be used by OMAP (specifically AM33xx atm) as well. This just moves the private EDMA API but does not support OMAP.

---
 arch/arm/Kconfig                           |    1 +
 arch/arm/common/Kconfig                    |    3 +
 arch/arm/common/Makefile                   |    1 +
 arch/arm/common/edma.c                     | 1588 ++++++++++++++++++++++++++++
 arch/arm/include/asm/mach/edma.h           |  267 +++++
 arch/arm/mach-davinci/Makefile             |    2 +-
 arch/arm/mach-davinci/devices.c            |    3 +-
 arch/arm/mach-davinci/dm355.c              |    2 +-
 arch/arm/mach-davinci/dm365.c              |    2 +-
 arch/arm/mach-davinci/dm644x.c             |    2 +-
 arch/arm/mach-davinci/dm646x.c             |    2 +-
 arch/arm/mach-davinci/dma.c                | 1588 ----------------------------
 arch/arm/mach-davinci/include/mach/asp.h   |    2 +-
 arch/arm/mach-davinci/include/mach/da8xx.h |    3 +-
 arch/arm/mach-davinci/include/mach/edma.h  |  267 -----
 arch/arm/mach-davinci/include/mach/spi.h   |    2 +-
 arch/arm/plat-omap/Kconfig                 |    1 +
 17 files changed, 1872 insertions(+), 1864 deletions(-)
 create mode 100644 arch/arm/common/edma.c
 create mode 100644 arch/arm/include/asm/mach/edma.h
 delete mode 100644 arch/arm/mach-davinci/dma.c
 delete mode 100644 arch/arm/mach-davinci/include/mach/edma.h
arch/arm/Kconfig +1 -0
index 2f88d8d..5272f72 100644
@@ -971,6 +971,7 @@ config ARCH_DAVINCI
 	select GENERIC_ALLOCATOR
 	select GENERIC_IRQ_CHIP
 	select ARCH_HAS_HOLES_MEMORYMODEL
+	select TI_PRIV_EDMA
 	help
 	  Support for TI's DaVinci platform.
 
arch/arm/common/Kconfig +3 -0
index 283fa1d..bd87838 100644
@@ -40,3 +40,6 @@ config SHARP_PARAM
 
 config SHARP_SCOOP
 	bool
+
+config TI_PRIV_EDMA
+	bool
arch/arm/common/Makefile +1 -0
index e8a4e58..d09a39b 100644
@@ -13,3 +13,4 @@ obj-$(CONFIG_SHARP_PARAM)	+= sharpsl_param.o
 obj-$(CONFIG_SHARP_SCOOP)	+= scoop.o
 obj-$(CONFIG_PCI_HOST_ITE8152)  += it8152.o
 obj-$(CONFIG_ARM_TIMER_SP804)	+= timer-sp.o
+obj-$(CONFIG_TI_PRIV_EDMA)	+= edma.o
arch/arm/common/edma.c new file +1588 -0

1,588 lines not on this page · raw message

arch/arm/include/asm/mach/edma.h new file +267 -0

267 lines not on this page · raw message

arch/arm/mach-davinci/Makefile +1 -1
index 2227eff..97c639e 100644
@@ -5,7 +5,7 @@
 
 # Common objects
 obj-y 			:= time.o clock.o serial.o psc.o \
-			   dma.o usb.o common.o sram.o aemif.o
+			   usb.o common.o sram.o aemif.o
 
 obj-$(CONFIG_DAVINCI_MUX)		+= mux.o
 
arch/arm/mach-davinci/devices.c +2 -1
index d2f96662..3407c20 100644
@@ -14,12 +14,13 @@
 #include <linux/dma-mapping.h>
 #include <linux/io.h>
 
+#include <asm/mach/edma.h>
+
 #include <mach/hardware.h>
 #include <mach/i2c.h>
 #include <mach/irqs.h>
 #include <mach/cputype.h>
 #include <mach/mux.h>
-#include <mach/edma.h>
 #include <mach/mmc.h>
 #include <mach/time.h>
 
arch/arm/mach-davinci/dm355.c +1 -1
index 678cd99..c7a432b 100644
@@ -16,10 +16,10 @@
 
 #include <linux/spi/spi.h>
 
+#include <asm/mach/edma.h>
 #include <asm/mach/map.h>
 
 #include <mach/cputype.h>
-#include <mach/edma.h>
 #include <mach/psc.h>
 #include <mach/mux.h>
 #include <mach/irqs.h>
arch/arm/mach-davinci/dm365.c +1 -1
index a50d49de..8e22ee8 100644
@@ -19,10 +19,10 @@
 #include <linux/dma-mapping.h>
 #include <linux/spi/spi.h>
 
+#include <asm/mach/edma.h>
 #include <asm/mach/map.h>
 
 #include <mach/cputype.h>
-#include <mach/edma.h>
 #include <mach/psc.h>
 #include <mach/mux.h>
 #include <mach/irqs.h>
arch/arm/mach-davinci/dm644x.c +1 -1
index c8b8666..562e51f 100644
@@ -13,10 +13,10 @@
 #include <linux/serial_8250.h>
 #include <linux/platform_device.h>
 
+#include <asm/mach/edma.h>
 #include <asm/mach/map.h>
 
 #include <mach/cputype.h>
-#include <mach/edma.h>
 #include <mach/irqs.h>
 #include <mach/psc.h>
 #include <mach/mux.h>
arch/arm/mach-davinci/dm646x.c +1 -1
index 9eb87c1..2fa4b5b 100644
@@ -14,10 +14,10 @@
 #include <linux/serial_8250.h>
 #include <linux/platform_device.h>
 
+#include <asm/mach/edma.h>
 #include <asm/mach/map.h>
 
 #include <mach/cputype.h>
-#include <mach/edma.h>
 #include <mach/irqs.h>
 #include <mach/psc.h>
 #include <mach/mux.h>
arch/arm/mach-davinci/dma.c deleted +0 -1588

1,062 lines not on this page · raw message

arch/arm/mach-davinci/include/mach/asp.h +1 -1
index 9aa2409..4fe8453 100644

Lines of this file are not shown. View the raw message.

arch/arm/mach-davinci/include/mach/da8xx.h +2 -1
index a2f1f27..6f70587 100644

Lines of this file are not shown. View the raw message.

arch/arm/mach-davinci/include/mach/edma.h deleted +0 -267

267 lines not on this page · raw message

arch/arm/mach-davinci/include/mach/spi.h +1 -1
index 7af305b..9f927da 100644

Lines of this file are not shown. View the raw message.

arch/arm/plat-omap/Kconfig +1 -0
index dd36eba..6ee991b 100644

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

Signature · 1 line
1.7.9.5

Part of the diff is not shown here. View the raw message.

#2 lore raw

RE: [RFC PATCH 01/13] ARM: davinci: move private EDMA API to arm/common

Quoted 5 lines · Matt

Move mach-davinci/dma.c to common/edma.c so it can be used by OMAP (specifically AM33xx atm) as well. This just moves the private EDMA API but does not support OMAP.

Quoted 13 lines
---
 arch/arm/Kconfig                           |    1 +
 arch/arm/common/Kconfig                    |    3 +
 arch/arm/common/Makefile                   |    1 +
 arch/arm/common/edma.c                     | 1588 ++++++++++++++++++++++++++++
 arch/arm/include/asm/mach/edma.h           |  267 +++++
 arch/arm/mach-davinci/Makefile             |    2 +-
 arch/arm/mach-davinci/devices.c            |    3 +-
 arch/arm/mach-davinci/dm355.c              |    2 +-
 arch/arm/mach-davinci/dm365.c              |    2 +-
 arch/arm/mach-davinci/dm644x.c             |    2 +-
 arch/arm/mach-davinci/dm646x.c             |    2 +-
 arch/arm/mach-davinci/dma.c                | 1588 ----------------------------

Please use ?M option, while generating patches via git-format-patch. This reduces the patch size if files are copied/renamed/moved.

Quoted 11 lines
 arch/arm/mach-davinci/include/mach/asp.h   |    2 +-
 arch/arm/mach-davinci/include/mach/da8xx.h |    3 +-
 arch/arm/mach-davinci/include/mach/edma.h  |  267 -----
 arch/arm/mach-davinci/include/mach/spi.h   |    2 +-
 arch/arm/plat-omap/Kconfig                 |    1 +
 17 files changed, 1872 insertions(+), 1864 deletions(-)
 create mode 100644 arch/arm/common/edma.c
 create mode 100644 arch/arm/include/asm/mach/edma.h
 delete mode 100644 arch/arm/mach-davinci/dma.c
 delete mode 100644 arch/arm/mach-davinci/include/mach/edma.h

...snip...
...snip...
...snip...

Quoted 9 lines
Signature · 7 lines
-- 
1.7.9.5

_______________________________________________
Davinci-linux-open-source mailing list
Davinci-linux-open-source at linux.davincidsp.com
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source

Regards,
Gururaja

#3 lore raw

Re: [RFC PATCH 01/13] ARM: davinci: move private EDMA API to arm/common

Quoted 21 lines · Gururaja
Quoted 5 lines · Matt

Move mach-davinci/dma.c to common/edma.c so it can be used by OMAP (specifically AM33xx atm) as well. This just moves the private EDMA API but does not support OMAP.

Quoted 13 lines
---
 arch/arm/Kconfig                           |    1 +
 arch/arm/common/Kconfig                    |    3 +
 arch/arm/common/Makefile                   |    1 +
 arch/arm/common/edma.c                     | 1588 ++++++++++++++++++++++++++++
 arch/arm/include/asm/mach/edma.h           |  267 +++++
 arch/arm/mach-davinci/Makefile             |    2 +-
 arch/arm/mach-davinci/devices.c            |    3 +-
 arch/arm/mach-davinci/dm355.c              |    2 +-
 arch/arm/mach-davinci/dm365.c              |    2 +-
 arch/arm/mach-davinci/dm644x.c             |    2 +-
 arch/arm/mach-davinci/dm646x.c             |    2 +-
 arch/arm/mach-davinci/dma.c                | 1588 ----------------------------
Quoted 2 lines

Please use –M option, while generating patches via git-format-patch. This reduces the patch size if files are copied/renamed/moved.

Yes, I didn't notice until the arm kernel list caught the >100k post. Will take care of this in v2.

-Matt

#4 lore raw

Re: [RFC PATCH 01/13] ARM: davinci: move private EDMA API to arm/common

In reply to Matt Porter
Quoted 11 lines · Matt Porter

Move mach-davinci/dma.c to common/edma.c so it can be used by OMAP (specifically AM33xx atm) as well. This just moves the private EDMA API but does not support OMAP.

---
 arch/arm/Kconfig                           |    1 +
 arch/arm/common/Kconfig                    |    3 +
 arch/arm/common/Makefile                   |    1 +
 arch/arm/common/edma.c                     | 1588 ++++++++++++++++++++++++++++
 arch/arm/include/asm/mach/edma.h           |  267 +++++

asm/mach should not be used as a dumping ground for platform header files. It is there to provide the interfaces between generic ARM architecture code and platform code. (At least four files that are there at the moment need to be moved out of there - patch series to follow...)

#5 lore raw

RE: [RFC PATCH 01/13] ARM: davinci: move private EDMA API to arm/common

Quoted 13 lines · Russell King - ARM Linux
Quoted 11 lines · Matt Porter

Move mach-davinci/dma.c to common/edma.c so it can be used by OMAP (specifically AM33xx atm) as well. This just moves the private EDMA API but does not support OMAP.

---
 arch/arm/Kconfig                           |    1 +
 arch/arm/common/Kconfig                    |    3 +
 arch/arm/common/Makefile                   |    1 +
 arch/arm/common/edma.c                     | 1588 ++++++++++++++++++++++++++++
 arch/arm/include/asm/mach/edma.h           |  267 +++++
Quoted 4 lines

asm/mach should not be used as a dumping ground for platform header files. It is there to provide the interfaces between generic ARM architecture code and platform code. (At least four files that are there at the moment need to be moved out of there - patch series to follow...)

Can this be moved to include/linux/platform_data/ ?

Quoted 5 lines

_______________________________________________
Davinci-linux-open-source mailing list
Davinci-linux-open-source at linux.davincidsp.com
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source

Regards,
Gururaja

#6 lore raw

Re: [RFC PATCH 01/13] ARM: davinci: move private EDMA API to arm/common

Quoted 14 lines · Gururaja
Quoted 13 lines · Russell King - ARM Linux
Quoted 11 lines · Matt Porter

Move mach-davinci/dma.c to common/edma.c so it can be used by OMAP (specifically AM33xx atm) as well. This just moves the private EDMA API but does not support OMAP.

---
 arch/arm/Kconfig                           |    1 +
 arch/arm/common/Kconfig                    |    3 +
 arch/arm/common/Makefile                   |    1 +
 arch/arm/common/edma.c                     | 1588 ++++++++++++++++++++++++++++
 arch/arm/include/asm/mach/edma.h           |  267 +++++
Quoted 6 lines
Quoted 4 lines

asm/mach should not be used as a dumping ground for platform header files. It is there to provide the interfaces between generic ARM architecture code and platform code. (At least four files that are there at the moment need to be moved out of there - patch series to follow...)

Can this be moved to include/linux/platform_data/ ?

Here's the pertinant question: "is it platform data?" Looking at the file, it appears to be internal data structures and register definitions for the driver itself. Therefore, it isn't platform data, and it shouldn't be living separately from the driver.

If the driver itself only makes use of the data structures, the data structures should be defined either within the driver, or a header file co-located next to the driver itself. The same goes for register definitions too.

The only structure that I can find which isn't internal to the driver is struct edma_soc_info, struct edma_rsv_info, and the enum dma_event_q. Those can go to include/linux/platform_data, but the rest should not.

#7 lore raw

Re: [RFC PATCH 01/13] ARM: davinci: move private EDMA API to arm/common

Quoted 27 lines · Russell King
Quoted 14 lines · Gururaja
Quoted 13 lines · Russell King - ARM Linux
Quoted 11 lines · Matt Porter

Move mach-davinci/dma.c to common/edma.c so it can be used by OMAP (specifically AM33xx atm) as well. This just moves the private EDMA API but does not support OMAP.

---
 arch/arm/Kconfig                           |    1 +
 arch/arm/common/Kconfig                    |    3 +
 arch/arm/common/Makefile                   |    1 +
 arch/arm/common/edma.c                     | 1588 ++++++++++++++++++++++++++++
 arch/arm/include/asm/mach/edma.h           |  267 +++++
Quoted 6 lines
Quoted 4 lines

asm/mach should not be used as a dumping ground for platform header files. It is there to provide the interfaces between generic ARM architecture code and platform code. (At least four files that are there at the moment need to be moved out of there - patch series to follow...)

Can this be moved to include/linux/platform_data/ ?

Here's the pertinant question: "is it platform data?" Looking at the file, it appears to be internal data structures and register definitions for the driver itself. Therefore, it isn't platform data, and it shouldn't be living separately from the driver.

Quoted 8 lines

If the driver itself only makes use of the data structures, the data structures should be defined either within the driver, or a header file co-located next to the driver itself. The same goes for register definitions too.

The only structure that I can find which isn't internal to the driver is struct edma_soc_info, struct edma_rsv_info, and the enum dma_event_q. Those can go to include/linux/platform_data, but the rest should not.

Ok, but is it ok to keep the actual private EDMA API portion in arch/arm/include/asm/mach/? It's not a problem to move the internal portions to a local include and that pdata to the appropriate place. We still need a place independent of mach-davinci and mach-omap2 to keep that portion of the include. I suppose it could be put in with the dmaengine wrapper's include/linux/edma.h but I hate to clutter that up when the private API will go away later.

-Matt

#8 lore raw

Re: [RFC PATCH 01/13] ARM: davinci: move private EDMA API to arm/common

Quoted 11 lines · Matt Porter
Quoted 10 lines · Russell King

Here's the pertinant question: "is it platform data?" Looking at the file, it appears to be internal data structures and register definitions for the driver itself. Therefore, it isn't platform data, and it shouldn't be living separately from the driver.

If the driver itself only makes use of the data structures, the data structures should be defined either within the driver, or a header file co-located next to the driver itself. The same goes for register definitions too.

Quoted 7 lines
Quoted 3 lines

The only structure that I can find which isn't internal to the driver is struct edma_soc_info, struct edma_rsv_info, and the enum dma_event_q. Those can go to include/linux/platform_data, but the rest should not.

Ok, but is it ok to keep the actual private EDMA API portion in arch/arm/include/asm/mach/? It's not a problem to move the internal portions to a local include and that pdata to the appropriate place.

Move the platform data parts to include/linux/platform_data. Move the driver specific parts to be either in the .c file for the driver, or in a .h file _along_ _side_ the .c file.

Private data for drivers should be kept as close to the driver as possible, whether that be in the same .c file as the driver itself, or a header co-located with the .c file.

#9 lore raw

RE: [RFC PATCH 01/13] ARM: davinci: move private EDMA API to arm/common

In reply to Matt Porter
Quoted 20 lines · Matt

Move mach-davinci/dma.c to common/edma.c so it can be used by OMAP (specifically AM33xx atm) as well. This just moves the private EDMA API but does not support OMAP.

---
 arch/arm/Kconfig                           |    1 +
 arch/arm/common/Kconfig                    |    3 +
 arch/arm/common/Makefile                   |    1 +
 arch/arm/common/edma.c                     | 1588 ++++++++++++++++++++++++++++
 arch/arm/include/asm/mach/edma.h           |  267 +++++
 arch/arm/mach-davinci/Makefile             |    2 +-
 arch/arm/mach-davinci/devices.c            |    3 +-
 arch/arm/mach-davinci/dm355.c              |    2 +-
 arch/arm/mach-davinci/dm365.c              |    2 +-
 arch/arm/mach-davinci/dm644x.c             |    2 +-
 arch/arm/mach-davinci/dm646x.c             |    2 +-
 arch/arm/mach-davinci/dma.c                | 1588 ----------------------------
Quoted 1 line
 arch/arm/mach-davinci/include/mach/asp.h   |    2 +-

This will clash with patch "ASoC/ARM: Davinci: McASP: split asp header into platform and audio specific" queued in ASoC tree by Mark Brown tree (Auio - ASoC Tree)

I forgot to mention this last time. Sorry

Quoted 10 lines
 arch/arm/mach-davinci/include/mach/da8xx.h |    3 +-
 arch/arm/mach-davinci/include/mach/edma.h  |  267 -----
 arch/arm/mach-davinci/include/mach/spi.h   |    2 +-
 arch/arm/plat-omap/Kconfig                 |    1 +
 17 files changed, 1872 insertions(+), 1864 deletions(-)
 create mode 100644 arch/arm/common/edma.c
 create mode 100644 arch/arm/include/asm/mach/edma.h
 delete mode 100644 arch/arm/mach-davinci/dma.c
 delete mode 100644 arch/arm/mach-davinci/include/mach/edma.h

...snip...
...snip...

Regards,
Gururaja

#10 lore raw

RFC PATCH 2/13 ARM: edma: remove unused transfer controller handlers

In reply to Matt Porter

Fix build on OMAP, the irqs are undefined on AM33xx. These error interrupt handlers were hardcoded as disabled so since they are unused code, simply remove them.

---
 arch/arm/common/edma.c |   37 -------------------------------------
 1 file changed, 37 deletions(-)
arch/arm/common/edma.c +0 -37
index cecc50e..001d268 100644
@@ -494,26 +494,6 @@ static irqreturn_t dma_ccerr_handler(int irq, void *data)
 	return IRQ_HANDLED;
 }
 
-/******************************************************************************
- *
- * Transfer controller error interrupt handlers
- *
- *****************************************************************************/
-
-#define tc_errs_handled	false	/* disabled as long as they're NOPs */
-
-static irqreturn_t dma_tc0err_handler(int irq, void *data)
-{
-	dev_dbg(data, "dma_tc0err_handler\n");
-	return IRQ_HANDLED;
-}
-
-static irqreturn_t dma_tc1err_handler(int irq, void *data)
-{
-	dev_dbg(data, "dma_tc1err_handler\n");
-	return IRQ_HANDLED;
-}
-
 static int reserve_contiguous_slots(int ctlr, unsigned int id,
 				     unsigned int num_slots,
 				     unsigned int start_slot)
@@ -1538,23 +1518,6 @@ static int __init edma_probe(struct platform_device *pdev)
 		arch_num_cc++;
 	}
 
-	if (tc_errs_handled) {
-		status = request_irq(IRQ_TCERRINT0, dma_tc0err_handler, 0,
-					"edma_tc0", &pdev->dev);
-		if (status < 0) {
-			dev_dbg(&pdev->dev, "request_irq %d failed --> %d\n",
-				IRQ_TCERRINT0, status);
-			return status;
-		}
-		status = request_irq(IRQ_TCERRINT, dma_tc1err_handler, 0,
-					"edma_tc1", &pdev->dev);
-		if (status < 0) {
-			dev_dbg(&pdev->dev, "request_irq %d --> %d\n",
-				IRQ_TCERRINT, status);
-			return status;
-		}
-	}
-
 	return 0;
 
 fail:
Signature · 1 line
1.7.9.5
#11 lore raw

RFC PATCH 3/13 ARM: edma: add DT and runtime PM support for AM335x

In reply to Matt Porter

Adds support for parsing the TI EDMA DT data into the required EDMA private API platform data.

Calls runtime PM API only in the DT case in order to unidle the associated hwmods on AM335x.

---
 arch/arm/common/edma.c           |  252 ++++++++++++++++++++++++++++++++++++--
 arch/arm/include/asm/mach/edma.h |    8 +-
 2 files changed, 244 insertions(+), 16 deletions(-)
arch/arm/common/edma.c +240 -12
index 001d268..f337f81 100644
@@ -24,6 +24,13 @@
 #include <linux/platform_device.h>
 #include <linux/io.h>
 #include <linux/slab.h>
+#include <linux/edma.h>
+#include <linux/err.h>
+#include <linux/of_address.h>
+#include <linux/of_device.h>
+#include <linux/of_dma.h>
+#include <linux/of_irq.h>
+#include <linux/pm_runtime.h>
 
 #include <asm/mach/edma.h>
 
@@ -1366,30 +1373,236 @@ void edma_clear_event(unsigned channel)
 EXPORT_SYMBOL(edma_clear_event);
 
 /*-----------------------------------------------------------------------*/
+static int edma_of_read_u32_to_s8_array(const struct device_node *np,
+					 const char *propname, s8 *out_values,
+					 size_t sz)
+{
+	struct property *prop = of_find_property(np, propname, NULL);
+	const __be32 *val;
+
+	if (!prop)
+		return -EINVAL;
+	if (!prop->value)
+		return -ENODATA;
+	if ((sz * sizeof(u32)) > prop->length)
+		return -EOVERFLOW;
+
+	val = prop->value;
+
+	while (sz--)
+		*out_values++ = (s8)(be32_to_cpup(val++) & 0xff);
+
+	/* Terminate it */
+	*out_values++ = -1;
+	*out_values++ = -1;
+
+	return 0;
+}
+
+static int edma_of_read_u32_to_s16_array(const struct device_node *np,
+					 const char *propname, s16 *out_values,
+					 size_t sz)
+{
+	struct property *prop = of_find_property(np, propname, NULL);
+	const __be32 *val;
+
+	if (!prop)
+		return -EINVAL;
+	if (!prop->value)
+		return -ENODATA;
+	if ((sz * sizeof(u32)) > prop->length)
+		return -EOVERFLOW;
+
+	val = prop->value;
+
+	while (sz--)
+		*out_values++ = (s16)(be32_to_cpup(val++) & 0xffff);
+
+	/* Terminate it */
+	*out_values++ = -1;
+	*out_values++ = -1;
+
+	return 0;
+}
+
+static int edma_of_parse_dt(struct device *dev,
+			    struct device_node *node,
+			    struct edma_soc_info *pdata)
+{
+	int ret = 0;
+	u32 value;
+	struct property *prop;
+	size_t sz;
+	struct edma_rsv_info *rsv_info;
+	s16 (*rsv_chans)[2], (*rsv_slots)[2];
+	s8 (*queue_tc_map)[2], (*queue_priority_map)[2];
+
+	ret = of_property_read_u32(node, "dma-channels", &value);
+	if (ret < 0)
+		return ret;
+	pdata->n_channel = value;
+
+	ret = of_property_read_u32(node, "ti,edma-regions", &value);
+	if (ret < 0)
+		return ret;
+	pdata->n_region = value;
+
+	ret = of_property_read_u32(node, "ti,edma-slots", &value);
+	if (ret < 0)
+		return ret;
+	pdata->n_slot = value;
+
+	pdata->n_cc = 1;
+	/* This is unused */
+	pdata->n_tc = 3;
+
+	rsv_info =
+		devm_kzalloc(dev, sizeof(struct edma_rsv_info), GFP_KERNEL);
+	if (!rsv_info)
+		return -ENOMEM;
+	pdata->rsv = rsv_info;
+
+	/* Build the reserved channel/slots arrays */
+	prop = of_find_property(node, "ti,edma-reserved-channels", &sz);
+	if (!prop)
+		return -EINVAL;
+
+	rsv_chans =
+		devm_kzalloc(dev, sz/sizeof(s16) + 2*sizeof(s16), GFP_KERNEL);
+	if (!rsv_chans)
+		return -ENOMEM;
+	pdata->rsv->rsv_chans = rsv_chans;
+
+	ret = edma_of_read_u32_to_s16_array(node, "ti,edma-reserved-channels",
+					    (s16 *)rsv_chans, sz/sizeof(u32));
+	if (ret < 0)
+		return ret;
+
+	prop = of_find_property(node, "ti,edma-reserved-slots", &sz);
+	if (!prop)
+		return -EINVAL;
+
+	rsv_slots = devm_kzalloc(dev,
+				 sz/sizeof(s16) + 2*sizeof(s16),
+				 GFP_KERNEL);
+	if (!rsv_slots)
+		return -ENOMEM;
+	pdata->rsv->rsv_slots = rsv_slots;
+
+	ret = edma_of_read_u32_to_s16_array(node,
+					    "ti,edma-reserved-slots",
+					    (s16 *)rsv_slots,
+					    sz/sizeof(u32));
+	if (ret < 0)
+		return ret;
+
+	prop = of_find_property(node, "ti,edma-queue-tc-map", &sz);
+	if (!prop)
+		return -EINVAL;
+
+	queue_tc_map = devm_kzalloc(dev,
+				    sz/sizeof(s8) + 2*sizeof(s8),
+				    GFP_KERNEL);
+	if (!rsv_slots)
+		return -ENOMEM;
+	pdata->queue_tc_mapping = queue_tc_map;
+
+	ret = edma_of_read_u32_to_s8_array(node,
+					   "ti,edma-queue-tc-map",
+					   (s8 *)queue_tc_map,
+					   sz/sizeof(u32));
+	if (ret < 0)
+		return ret;
+
+	prop = of_find_property(node, "ti,edma-queue-priority-map", &sz);
+	if (!prop)
+		return -EINVAL;
+
+	queue_priority_map = devm_kzalloc(dev,
+					  sz/sizeof(s8) + 2*sizeof(s8),
+					  GFP_KERNEL);
+	if (!rsv_slots)
+		return -ENOMEM;
+	pdata->queue_priority_mapping = queue_priority_map;
+
+	ret = edma_of_read_u32_to_s8_array(node,
+					   "ti,edma-queue-tc-map",
+					   (s8 *)queue_priority_map,
+					   sz/sizeof(u32));
+	if (ret < 0)
+		return ret;
+
+	ret = of_property_read_u32(node, "ti,edma-default-queue", &value);
+	if (ret < 0)
+		return ret;
+	pdata->default_queue = value;
+
+	return ret;
+}
+
+static struct of_dma_filter_info edma_filter_info = {
+	.filter_fn = edma_filter_fn,
+};
 
 static int __init edma_probe(struct platform_device *pdev)
 {
 	struct edma_soc_info	**info = pdev->dev.platform_data;
-	const s8		(*queue_priority_mapping)[2];
-	const s8		(*queue_tc_mapping)[2];
+	s8			(*queue_priority_mapping)[2];
+	s8			(*queue_tc_mapping)[2];
 	int			i, j, off, ln, found = 0;
 	int			status = -1;
-	const s16		(*rsv_chans)[2];
-	const s16		(*rsv_slots)[2];
+	s16			(*rsv_chans)[2];
+	s16			(*rsv_slots)[2];
 	int			irq[EDMA_MAX_CC] = {0, 0};
 	int			err_irq[EDMA_MAX_CC] = {0, 0};
 	struct resource		*r[EDMA_MAX_CC] = {NULL};
+	struct resource		res[EDMA_MAX_CC];
 	resource_size_t		len[EDMA_MAX_CC];
 	char			res_name[10];
 	char			irq_name[10];
+	struct device_node	*node = pdev->dev.of_node;
+	struct device		*dev = &pdev->dev;
+	struct edma_soc_info	*pdata;
+
+	if (node) {
+		int ret;
+		pdata = devm_kzalloc(dev,
+				     sizeof(struct edma_soc_info),
+				     GFP_KERNEL);
+		edma_of_parse_dt(dev, node, pdata);
+		info = &pdata;
+		dma_cap_set(DMA_SLAVE, edma_filter_info.dma_cap);
+		of_dma_controller_register(dev->of_node,
+					   of_dma_simple_xlate,
+					   &edma_filter_info);
+		pm_runtime_enable(dev);
+		ret = pm_runtime_get_sync(dev);
+		if (IS_ERR_VALUE(ret)) {
+			dev_err(dev, "pm_runtime_get_sync() failed\n");
+			return ret;
+		}
+	}
 
 	if (!info)
 		return -ENODEV;
 
 	for (j = 0; j < EDMA_MAX_CC; j++) {
-		sprintf(res_name, "edma_cc%d", j);
-		r[j] = platform_get_resource_byname(pdev, IORESOURCE_MEM,
+		if (node) {
+			int err;
+			err = of_address_to_resource(node, 0, &res[j]);
+			if (err) {
+				dev_err(dev,
+					"unable to find 'reg' property\n");
+				return -EIO;
+			}
+			r[j] = &res[j];
+
+		} else {
+			sprintf(res_name, "edma_cc%d", j);
+			r[j] = platform_get_resource_byname(pdev,
+						IORESOURCE_MEM,
 						res_name);
+		}
 		if (!r[j] || !info[j]) {
 			if (found)
 				break;
@@ -1465,8 +1678,12 @@ static int __init edma_probe(struct platform_device *pdev)
 			}
 		}
 
-		sprintf(irq_name, "edma%d", j);
-		irq[j] = platform_get_irq_byname(pdev, irq_name);
+		if (node)
+			irq[j] = irq_of_parse_and_map(node, 0);
+		else {
+			sprintf(irq_name, "edma%d", j);
+			irq[j] = platform_get_irq_byname(pdev, irq_name);
+		}
 		edma_cc[j]->irq_res_start = irq[j];
 		status = request_irq(irq[j], dma_irq_handler, 0, "edma",
 					&pdev->dev);
@@ -1476,8 +1693,12 @@ static int __init edma_probe(struct platform_device *pdev)
 			goto fail;
 		}
 
-		sprintf(irq_name, "edma%d_err", j);
-		err_irq[j] = platform_get_irq_byname(pdev, irq_name);
+		if (node)
+			err_irq[j] = irq_of_parse_and_map(node, 2);
+		else {
+			sprintf(irq_name, "edma%d_err", j);
+			err_irq[j] = platform_get_irq_byname(pdev, irq_name);
+		}
 		edma_cc[j]->irq_res_end = err_irq[j];
 		status = request_irq(err_irq[j], dma_ccerr_handler, 0,
 					"edma_error", &pdev->dev);
@@ -1538,9 +1759,17 @@ fail1:
 	return status;
 }
 
+static const struct of_device_id edma_of_ids[] = {
+	{ .compatible = "ti,edma3", },
+	{}
+};
 
 static struct platform_driver edma_driver = {
-	.driver.name	= "edma",
+	.driver = {
+		.name	= "edma",
+		.of_match_table = edma_of_ids,
+	},
+	.probe = edma_probe,
 };
 
 static int __init edma_init(void)
@@ -1548,4 +1777,3 @@ static int __init edma_init(void)
 	return platform_driver_probe(&edma_driver, edma_probe);
 }
 arch_initcall(edma_init);
-
arch/arm/include/asm/mach/edma.h +4 -4
index 7e84c90..ce5f6f8 100644
@@ -237,8 +237,8 @@ void edma_resume(unsigned channel);
 
 struct edma_rsv_info {
 
-	const s16	(*rsv_chans)[2];
-	const s16	(*rsv_slots)[2];
+	s16		(*rsv_chans)[2];
+	s16		(*rsv_slots)[2];
 };
 
 /* platform_data for EDMA driver */
@@ -260,8 +260,8 @@ struct edma_soc_info {
 	/* Resource reservation for other cores */
 	struct edma_rsv_info	*rsv;
 
-	const s8	(*queue_tc_mapping)[2];
-	const s8	(*queue_priority_mapping)[2];
+	s8	(*queue_tc_mapping)[2];
+	s8	(*queue_priority_mapping)[2];
 };
 
 #endif
Signature · 1 line
1.7.9.5
#12 lore raw

RE: [RFC PATCH 03/13] ARM: edma: add DT and runtime PM support for AM335x

Quoted 11 lines · Matt

Adds support for parsing the TI EDMA DT data into the required EDMA private API platform data.

Calls runtime PM API only in the DT case in order to unidle the associated hwmods on AM335x.

---
 arch/arm/common/edma.c           |  252 ++++++++++++++++++++++++++++++++++++--
 arch/arm/include/asm/mach/edma.h |    8 +-
 2 files changed, 244 insertions(+), 16 deletions(-)

The binding documentation should be updated along with the driver change that does introduce the binding. You could just merged patch #4 and #5.

Quoted 122 lines
arch/arm/common/edma.c +106 -0
index 001d268..f337f81 100644
@@ -24,6 +24,13 @@
 #include <linux/platform_device.h>
 #include <linux/io.h>
 #include <linux/slab.h>
+#include <linux/edma.h>
+#include <linux/err.h>
+#include <linux/of_address.h>
+#include <linux/of_device.h>
+#include <linux/of_dma.h>
+#include <linux/of_irq.h>
+#include <linux/pm_runtime.h>
 
 #include <asm/mach/edma.h>
 
@@ -1366,30 +1373,236 @@ void edma_clear_event(unsigned channel)
 EXPORT_SYMBOL(edma_clear_event);
 
 /*-----------------------------------------------------------------------*/
+static int edma_of_read_u32_to_s8_array(const struct device_node *np,
+					 const char *propname, s8 *out_values,
+					 size_t sz)
+{
+	struct property *prop = of_find_property(np, propname, NULL);
+	const __be32 *val;
+
+	if (!prop)
+		return -EINVAL;
+	if (!prop->value)
+		return -ENODATA;
+	if ((sz * sizeof(u32)) > prop->length)
+		return -EOVERFLOW;
+
+	val = prop->value;
+
+	while (sz--)
+		*out_values++ = (s8)(be32_to_cpup(val++) & 0xff);
+
+	/* Terminate it */
+	*out_values++ = -1;
+	*out_values++ = -1;
+
+	return 0;
+}
+
+static int edma_of_read_u32_to_s16_array(const struct device_node *np,
+					 const char *propname, s16 *out_values,
+					 size_t sz)
+{
+	struct property *prop = of_find_property(np, propname, NULL);
+	const __be32 *val;
+
+	if (!prop)
+		return -EINVAL;
+	if (!prop->value)
+		return -ENODATA;
+	if ((sz * sizeof(u32)) > prop->length)
+		return -EOVERFLOW;
+
+	val = prop->value;
+
+	while (sz--)
+		*out_values++ = (s16)(be32_to_cpup(val++) & 0xffff);
+
+	/* Terminate it */
+	*out_values++ = -1;
+	*out_values++ = -1;
+
+	return 0;
+}
+
+static int edma_of_parse_dt(struct device *dev,
+			    struct device_node *node,
+			    struct edma_soc_info *pdata)
+{
+	int ret = 0;
+	u32 value;
+	struct property *prop;
+	size_t sz;
+	struct edma_rsv_info *rsv_info;
+	s16 (*rsv_chans)[2], (*rsv_slots)[2];
+	s8 (*queue_tc_map)[2], (*queue_priority_map)[2];
+
+	ret = of_property_read_u32(node, "dma-channels", &value);
+	if (ret < 0)
+		return ret;
+	pdata->n_channel = value;
+
+	ret = of_property_read_u32(node, "ti,edma-regions", &value);
+	if (ret < 0)
+		return ret;
+	pdata->n_region = value;
+
+	ret = of_property_read_u32(node, "ti,edma-slots", &value);
+	if (ret < 0)
+		return ret;
+	pdata->n_slot = value;
+
+	pdata->n_cc = 1;
+	/* This is unused */
+	pdata->n_tc = 3;
+
+	rsv_info =
+		devm_kzalloc(dev, sizeof(struct edma_rsv_info), GFP_KERNEL);
+	if (!rsv_info)
+		return -ENOMEM;
+	pdata->rsv = rsv_info;
+
+	/* Build the reserved channel/slots arrays */
+	prop = of_find_property(node, "ti,edma-reserved-channels", &sz);
+	if (!prop)
+		return -EINVAL;
+
+	rsv_chans =
+		devm_kzalloc(dev, sz/sizeof(s16) + 2*sizeof(s16), GFP_KERNEL);
+	if (!rsv_chans)
+		return -ENOMEM;
+	pdata->rsv->rsv_chans = rsv_chans;

arch/arm/common/edma.c void edma_clear_event(unsigned channel) · line 1484

Quoted 10 lines
arch/arm/common/edma.c +10 -0
+
+	ret = edma_of_read_u32_to_s16_array(node, "ti,edma-reserved-channels",
+					    (s16 *)rsv_chans, sz/sizeof(u32));
+	if (ret < 0)
+		return ret;
+
+	prop = of_find_property(node, "ti,edma-reserved-slots", &sz);
+	if (!prop)
+		return -EINVAL;
+

Binding Documentation mentions edma-reserved-[channels/slots] as optional. But here the code returns as error if they are not found. Kindly reconfirm

Quoted 1 line

From patch-set 5/13

+Optional properties:

+- ti,edma-reserved-channels: List of reserved channel regions
+- ti,edma-reserved-slots: List of reserved slot regions
Quoted 65 lines
arch/arm/common/edma.c +61 -0
+	rsv_slots = devm_kzalloc(dev,
+				 sz/sizeof(s16) + 2*sizeof(s16),
+				 GFP_KERNEL);
+	if (!rsv_slots)
+		return -ENOMEM;
+	pdata->rsv->rsv_slots = rsv_slots;
+
+	ret = edma_of_read_u32_to_s16_array(node,
+					    "ti,edma-reserved-slots",
+					    (s16 *)rsv_slots,
+					    sz/sizeof(u32));
+	if (ret < 0)
+		return ret;
+
+	prop = of_find_property(node, "ti,edma-queue-tc-map", &sz);
+	if (!prop)
+		return -EINVAL;
+
+	queue_tc_map = devm_kzalloc(dev,
+				    sz/sizeof(s8) + 2*sizeof(s8),
+				    GFP_KERNEL);
+	if (!rsv_slots)
+		return -ENOMEM;
+	pdata->queue_tc_mapping = queue_tc_map;
+
+	ret = edma_of_read_u32_to_s8_array(node,
+					   "ti,edma-queue-tc-map",
+					   (s8 *)queue_tc_map,
+					   sz/sizeof(u32));
+	if (ret < 0)
+		return ret;
+
+	prop = of_find_property(node, "ti,edma-queue-priority-map", &sz);
+	if (!prop)
+		return -EINVAL;
+
+	queue_priority_map = devm_kzalloc(dev,
+					  sz/sizeof(s8) + 2*sizeof(s8),
+					  GFP_KERNEL);
+	if (!rsv_slots)
+		return -ENOMEM;
+	pdata->queue_priority_mapping = queue_priority_map;
+
+	ret = edma_of_read_u32_to_s8_array(node,
+					   "ti,edma-queue-tc-map",
+					   (s8 *)queue_priority_map,
+					   sz/sizeof(u32));
+	if (ret < 0)
+		return ret;
+
+	ret = of_property_read_u32(node, "ti,edma-default-queue", &value);
+	if (ret < 0)
+		return ret;
+	pdata->default_queue = value;
+
+	return ret;
+}
+
+static struct of_dma_filter_info edma_filter_info = {
+	.filter_fn = edma_filter_fn,
+};
 
 static int __init edma_probe(struct platform_device *pdev)
 {
 	struct edma_soc_info	**info = pdev->dev.platform_data;

arch/arm/common/edma.c void edma_clear_event(unsigned channel) · line 1555

Quoted 10 lines
arch/arm/common/edma.c +4 -4
-	const s8		(*queue_priority_mapping)[2];
-	const s8		(*queue_tc_mapping)[2];
+	s8			(*queue_priority_mapping)[2];
+	s8			(*queue_tc_mapping)[2];
 	int			i, j, off, ln, found = 0;
 	int			status = -1;
-	const s16		(*rsv_chans)[2];
-	const s16		(*rsv_slots)[2];
+	s16			(*rsv_chans)[2];
+	s16			(*rsv_slots)[2];

What is the significance of the number "2" in all above members?

Quoted 89 lines
arch/arm/common/edma.c +50 -6
 	int			irq[EDMA_MAX_CC] = {0, 0};
 	int			err_irq[EDMA_MAX_CC] = {0, 0};
 	struct resource		*r[EDMA_MAX_CC] = {NULL};
+	struct resource		res[EDMA_MAX_CC];
 	resource_size_t		len[EDMA_MAX_CC];
 	char			res_name[10];
 	char			irq_name[10];
+	struct device_node	*node = pdev->dev.of_node;
+	struct device		*dev = &pdev->dev;
+	struct edma_soc_info	*pdata;
+
+	if (node) {
+		int ret;
+		pdata = devm_kzalloc(dev,
+				     sizeof(struct edma_soc_info),
+				     GFP_KERNEL);
+		edma_of_parse_dt(dev, node, pdata);
+		info = &pdata;
+		dma_cap_set(DMA_SLAVE, edma_filter_info.dma_cap);
+		of_dma_controller_register(dev->of_node,
+					   of_dma_simple_xlate,
+					   &edma_filter_info);
+		pm_runtime_enable(dev);
+		ret = pm_runtime_get_sync(dev);
+		if (IS_ERR_VALUE(ret)) {
+			dev_err(dev, "pm_runtime_get_sync() failed\n");
+			return ret;
+		}
+	}
 
 	if (!info)
 		return -ENODEV;
 
 	for (j = 0; j < EDMA_MAX_CC; j++) {
-		sprintf(res_name, "edma_cc%d", j);
-		r[j] = platform_get_resource_byname(pdev, IORESOURCE_MEM,
+		if (node) {
+			int err;
+			err = of_address_to_resource(node, 0, &res[j]);
+			if (err) {
+				dev_err(dev,
+					"unable to find 'reg' property\n");
+				return -EIO;
+			}
+			r[j] = &res[j];
+
+		} else {
+			sprintf(res_name, "edma_cc%d", j);
+			r[j] = platform_get_resource_byname(pdev,
+						IORESOURCE_MEM,
 						res_name);
+		}
 		if (!r[j] || !info[j]) {
 			if (found)
 				break;
@@ -1465,8 +1678,12 @@ static int __init edma_probe(struct platform_device *pdev)
 			}
 		}
 
-		sprintf(irq_name, "edma%d", j);
-		irq[j] = platform_get_irq_byname(pdev, irq_name);
+		if (node)
+			irq[j] = irq_of_parse_and_map(node, 0);
+		else {
+			sprintf(irq_name, "edma%d", j);
+			irq[j] = platform_get_irq_byname(pdev, irq_name);
+		}
 		edma_cc[j]->irq_res_start = irq[j];
 		status = request_irq(irq[j], dma_irq_handler, 0, "edma",
 					&pdev->dev);
@@ -1476,8 +1693,12 @@ static int __init edma_probe(struct platform_device *pdev)
 			goto fail;
 		}
 
-		sprintf(irq_name, "edma%d_err", j);
-		err_irq[j] = platform_get_irq_byname(pdev, irq_name);
+		if (node)
+			err_irq[j] = irq_of_parse_and_map(node, 2);
+		else {
+			sprintf(irq_name, "edma%d_err", j);
+			err_irq[j] = platform_get_irq_byname(pdev, irq_name);
+		}
 		edma_cc[j]->irq_res_end = err_irq[j];
 		status = request_irq(err_irq[j], dma_ccerr_handler, 0,
 					"edma_error", &pdev->dev);
@@ -1538,9 +1759,17 @@ fail1:
 	return status;
 }
 

arch/arm/common/edma.c fail1: · line 1770

Quoted 10 lines
arch/arm/common/edma.c +7 -1
+static const struct of_device_id edma_of_ids[] = {
+	{ .compatible = "ti,edma3", },
+	{}
+};
 
 static struct platform_driver edma_driver = {
-	.driver.name	= "edma",
+	.driver = {
+		.name	= "edma",
+		.of_match_table = edma_of_ids,

Won't this fail/warn when CONFIG_OF not selected/enabled?

arch/arm/common/edma.c static int __init edma_init(void) · line 1551

Quoted 10 lines
arch/arm/common/edma.c +2 -1
+	},
+	.probe = edma_probe,
 };
 
 static int __init edma_init(void)
@@ -1548,4 +1777,3 @@ static int __init edma_init(void)
 	return platform_driver_probe(&edma_driver, edma_probe);
 }
 arch_initcall(edma_init);
-

Stray change I believe.

Quoted 34 lines
arch/arm/include/asm/mach/edma.h +4 -4
index 7e84c90..ce5f6f8 100644
@@ -237,8 +237,8 @@ void edma_resume(unsigned channel);
 
 struct edma_rsv_info {
 
-	const s16	(*rsv_chans)[2];
-	const s16	(*rsv_slots)[2];
+	s16		(*rsv_chans)[2];
+	s16		(*rsv_slots)[2];
 };
 
 /* platform_data for EDMA driver */
@@ -260,8 +260,8 @@ struct edma_soc_info {
 	/* Resource reservation for other cores */
 	struct edma_rsv_info	*rsv;
 
-	const s8	(*queue_tc_mapping)[2];
-	const s8	(*queue_priority_mapping)[2];
+	s8	(*queue_tc_mapping)[2];
+	s8	(*queue_priority_mapping)[2];
 };
 
 #endif
Signature · 6 lines
1.7.9.5

_______________________________________________
Davinci-linux-open-source mailing list
Davinci-linux-open-source at linux.davincidsp.com
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source

Regards,
Gururaja

#13 lore raw

Re: [RFC PATCH 03/13] ARM: edma: add DT and runtime PM support for AM335x

Quoted 13 lines · Gururaja
Quoted 11 lines · Matt

Adds support for parsing the TI EDMA DT data into the required EDMA private API platform data.

Calls runtime PM API only in the DT case in order to unidle the associated hwmods on AM335x.

---
 arch/arm/common/edma.c           |  252 ++++++++++++++++++++++++++++++++++++--
 arch/arm/include/asm/mach/edma.h |    8 +-
 2 files changed, 244 insertions(+), 16 deletions(-)
Quoted 3 lines

The binding documentation should be updated along with the driver change that does introduce the binding. You could just merged patch #4 and #5.

Hi Gururaja,

Sorry I missed these comments for this long...

I've been asked by maintainers to keep the binding separate in other drivers. It is documentation that is independent of the driver in any case...I'll move the binding before this implementation though.

Quoted 135 lines
Quoted 121 lines
arch/arm/common/edma.c +106 -0
index 001d268..f337f81 100644
@@ -24,6 +24,13 @@
 #include <linux/platform_device.h>
 #include <linux/io.h>
 #include <linux/slab.h>
+#include <linux/edma.h>
+#include <linux/err.h>
+#include <linux/of_address.h>
+#include <linux/of_device.h>
+#include <linux/of_dma.h>
+#include <linux/of_irq.h>
+#include <linux/pm_runtime.h>
 
 #include <asm/mach/edma.h>
 
@@ -1366,30 +1373,236 @@ void edma_clear_event(unsigned channel)
 EXPORT_SYMBOL(edma_clear_event);
 
 /*-----------------------------------------------------------------------*/
+static int edma_of_read_u32_to_s8_array(const struct device_node *np,
+					 const char *propname, s8 *out_values,
+					 size_t sz)
+{
+	struct property *prop = of_find_property(np, propname, NULL);
+	const __be32 *val;
+
+	if (!prop)
+		return -EINVAL;
+	if (!prop->value)
+		return -ENODATA;
+	if ((sz * sizeof(u32)) > prop->length)
+		return -EOVERFLOW;
+
+	val = prop->value;
+
+	while (sz--)
+		*out_values++ = (s8)(be32_to_cpup(val++) & 0xff);
+
+	/* Terminate it */
+	*out_values++ = -1;
+	*out_values++ = -1;
+
+	return 0;
+}
+
+static int edma_of_read_u32_to_s16_array(const struct device_node *np,
+					 const char *propname, s16 *out_values,
+					 size_t sz)
+{
+	struct property *prop = of_find_property(np, propname, NULL);
+	const __be32 *val;
+
+	if (!prop)
+		return -EINVAL;
+	if (!prop->value)
+		return -ENODATA;
+	if ((sz * sizeof(u32)) > prop->length)
+		return -EOVERFLOW;
+
+	val = prop->value;
+
+	while (sz--)
+		*out_values++ = (s16)(be32_to_cpup(val++) & 0xffff);
+
+	/* Terminate it */
+	*out_values++ = -1;
+	*out_values++ = -1;
+
+	return 0;
+}
+
+static int edma_of_parse_dt(struct device *dev,
+			    struct device_node *node,
+			    struct edma_soc_info *pdata)
+{
+	int ret = 0;
+	u32 value;
+	struct property *prop;
+	size_t sz;
+	struct edma_rsv_info *rsv_info;
+	s16 (*rsv_chans)[2], (*rsv_slots)[2];
+	s8 (*queue_tc_map)[2], (*queue_priority_map)[2];
+
+	ret = of_property_read_u32(node, "dma-channels", &value);
+	if (ret < 0)
+		return ret;
+	pdata->n_channel = value;
+
+	ret = of_property_read_u32(node, "ti,edma-regions", &value);
+	if (ret < 0)
+		return ret;
+	pdata->n_region = value;
+
+	ret = of_property_read_u32(node, "ti,edma-slots", &value);
+	if (ret < 0)
+		return ret;
+	pdata->n_slot = value;
+
+	pdata->n_cc = 1;
+	/* This is unused */
+	pdata->n_tc = 3;
+
+	rsv_info =
+		devm_kzalloc(dev, sizeof(struct edma_rsv_info), GFP_KERNEL);
+	if (!rsv_info)
+		return -ENOMEM;
+	pdata->rsv = rsv_info;
+
+	/* Build the reserved channel/slots arrays */
+	prop = of_find_property(node, "ti,edma-reserved-channels", &sz);
+	if (!prop)
+		return -EINVAL;
+
+	rsv_chans =
+		devm_kzalloc(dev, sz/sizeof(s16) + 2*sizeof(s16), GFP_KERNEL);
+	if (!rsv_chans)
+		return -ENOMEM;
+	pdata->rsv->rsv_chans = rsv_chans;

arch/arm/common/edma.c void edma_clear_event(unsigned channel) · line 1484

Quoted 10 lines
arch/arm/common/edma.c +10 -0
+
+	ret = edma_of_read_u32_to_s16_array(node, "ti,edma-reserved-channels",
+					    (s16 *)rsv_chans, sz/sizeof(u32));
+	if (ret < 0)
+		return ret;
+
+	prop = of_find_property(node, "ti,edma-reserved-slots", &sz);
+	if (!prop)
+		return -EINVAL;
+

Binding Documentation mentions edma-reserved-[channels/slots] as optional. But here the code returns as error if they are not found. Kindly reconfirm

Quoted 5 lines
Quoted 1 line

From patch-set 5/13

+Optional properties:

+- ti,edma-reserved-channels: List of reserved channel regions
+- ti,edma-reserved-slots: List of reserved slot regions

Good catch, the binding documentation is correct and I will fix my implementation to match.

Quoted 62 lines
Quoted 62 lines
arch/arm/common/edma.c +61 -0
+	rsv_slots = devm_kzalloc(dev,
+				 sz/sizeof(s16) + 2*sizeof(s16),
+				 GFP_KERNEL);
+	if (!rsv_slots)
+		return -ENOMEM;
+	pdata->rsv->rsv_slots = rsv_slots;
+
+	ret = edma_of_read_u32_to_s16_array(node,
+					    "ti,edma-reserved-slots",
+					    (s16 *)rsv_slots,
+					    sz/sizeof(u32));
+	if (ret < 0)
+		return ret;
+
+	prop = of_find_property(node, "ti,edma-queue-tc-map", &sz);
+	if (!prop)
+		return -EINVAL;
+
+	queue_tc_map = devm_kzalloc(dev,
+				    sz/sizeof(s8) + 2*sizeof(s8),
+				    GFP_KERNEL);
+	if (!rsv_slots)
+		return -ENOMEM;
+	pdata->queue_tc_mapping = queue_tc_map;
+
+	ret = edma_of_read_u32_to_s8_array(node,
+					   "ti,edma-queue-tc-map",
+					   (s8 *)queue_tc_map,
+					   sz/sizeof(u32));
+	if (ret < 0)
+		return ret;
+
+	prop = of_find_property(node, "ti,edma-queue-priority-map", &sz);
+	if (!prop)
+		return -EINVAL;
+
+	queue_priority_map = devm_kzalloc(dev,
+					  sz/sizeof(s8) + 2*sizeof(s8),
+					  GFP_KERNEL);
+	if (!rsv_slots)
+		return -ENOMEM;
+	pdata->queue_priority_mapping = queue_priority_map;
+
+	ret = edma_of_read_u32_to_s8_array(node,
+					   "ti,edma-queue-tc-map",
+					   (s8 *)queue_priority_map,
+					   sz/sizeof(u32));
+	if (ret < 0)
+		return ret;
+
+	ret = of_property_read_u32(node, "ti,edma-default-queue", &value);
+	if (ret < 0)
+		return ret;
+	pdata->default_queue = value;
+
+	return ret;
+}
+
+static struct of_dma_filter_info edma_filter_info = {
+	.filter_fn = edma_filter_fn,
+};
Quoted 15 lines

arch/arm/common/edma.c void edma_clear_event(unsigned channel) · line 1555

Quoted 13 lines

static int __init edma_probe(struct platform_device *pdev) {

arch/arm/common/edma.c +4 -4
 	struct edma_soc_info	**info = pdev->dev.platform_data;
-	const s8		(*queue_priority_mapping)[2];
-	const s8		(*queue_tc_mapping)[2];
+	s8			(*queue_priority_mapping)[2];
+	s8			(*queue_tc_mapping)[2];
 	int			i, j, off, ln, found = 0;
 	int			status = -1;
-	const s16		(*rsv_chans)[2];
-	const s16		(*rsv_slots)[2];
+	s16			(*rsv_chans)[2];
+	s16			(*rsv_slots)[2];

What is the significance of the number "2" in all above members?

Those should all be EDMA_MAX_CC, as that is the significance. I will address that. Incidentally, this is expected to be short-lived after Davinci ASoC is fully converted to dmaengine. One of the big problems in the private EDMA API driver from an implementation POV is that the driver attempt to encompass all channel controller instances in a single device match. This results in this legacy pdata structure that we adopt for compatibility. As part of folding this into drivers/dma/edma.c, we'll have a device instance per channel controller that will nicely clean this up. Not to mention all the unused code we'll remove.

Quoted 94 lines
Quoted 94 lines
arch/arm/common/edma.c +54 -6
 	int			irq[EDMA_MAX_CC] = {0, 0};
 	int			err_irq[EDMA_MAX_CC] = {0, 0};
 	struct resource		*r[EDMA_MAX_CC] = {NULL};
+	struct resource		res[EDMA_MAX_CC];
 	resource_size_t		len[EDMA_MAX_CC];
 	char			res_name[10];
 	char			irq_name[10];
+	struct device_node	*node = pdev->dev.of_node;
+	struct device		*dev = &pdev->dev;
+	struct edma_soc_info	*pdata;
+
+	if (node) {
+		int ret;
+		pdata = devm_kzalloc(dev,
+				     sizeof(struct edma_soc_info),
+				     GFP_KERNEL);
+		edma_of_parse_dt(dev, node, pdata);
+		info = &pdata;
+		dma_cap_set(DMA_SLAVE, edma_filter_info.dma_cap);
+		of_dma_controller_register(dev->of_node,
+					   of_dma_simple_xlate,
+					   &edma_filter_info);
+		pm_runtime_enable(dev);
+		ret = pm_runtime_get_sync(dev);
+		if (IS_ERR_VALUE(ret)) {
+			dev_err(dev, "pm_runtime_get_sync() failed\n");
+			return ret;
+		}
+	}
 
 	if (!info)
 		return -ENODEV;
 
 	for (j = 0; j < EDMA_MAX_CC; j++) {
-		sprintf(res_name, "edma_cc%d", j);
-		r[j] = platform_get_resource_byname(pdev, IORESOURCE_MEM,
+		if (node) {
+			int err;
+			err = of_address_to_resource(node, 0, &res[j]);
+			if (err) {
+				dev_err(dev,
+					"unable to find 'reg' property\n");
+				return -EIO;
+			}
+			r[j] = &res[j];
+
+		} else {
+			sprintf(res_name, "edma_cc%d", j);
+			r[j] = platform_get_resource_byname(pdev,
+						IORESOURCE_MEM,
 						res_name);
+		}
 		if (!r[j] || !info[j]) {
 			if (found)
 				break;
@@ -1465,8 +1678,12 @@ static int __init edma_probe(struct platform_device *pdev)
 			}
 		}
 
-		sprintf(irq_name, "edma%d", j);
-		irq[j] = platform_get_irq_byname(pdev, irq_name);
+		if (node)
+			irq[j] = irq_of_parse_and_map(node, 0);
+		else {
+			sprintf(irq_name, "edma%d", j);
+			irq[j] = platform_get_irq_byname(pdev, irq_name);
+		}
 		edma_cc[j]->irq_res_start = irq[j];
 		status = request_irq(irq[j], dma_irq_handler, 0, "edma",
 					&pdev->dev);
@@ -1476,8 +1693,12 @@ static int __init edma_probe(struct platform_device *pdev)
 			goto fail;
 		}
 
-		sprintf(irq_name, "edma%d_err", j);
-		err_irq[j] = platform_get_irq_byname(pdev, irq_name);
+		if (node)
+			err_irq[j] = irq_of_parse_and_map(node, 2);
+		else {
+			sprintf(irq_name, "edma%d_err", j);
+			err_irq[j] = platform_get_irq_byname(pdev, irq_name);
+		}
 		edma_cc[j]->irq_res_end = err_irq[j];
 		status = request_irq(err_irq[j], dma_ccerr_handler, 0,
 					"edma_error", &pdev->dev);
@@ -1538,9 +1759,17 @@ fail1:
 	return status;
 }
 
+static const struct of_device_id edma_of_ids[] = {
+	{ .compatible = "ti,edma3", },
+	{}
+};
 
Quoted 7 lines

arch/arm/common/edma.c fail1: · line 1770

Quoted 5 lines
arch/arm/common/edma.c +3 -1
 static struct platform_driver edma_driver = {
-	.driver.name	= "edma",
+	.driver = {
+		.name	= "edma",
+		.of_match_table = edma_of_ids,

Won't this fail/warn when CONFIG_OF not selected/enabled?

No. of_match_table is no longer dependent on CONFIG_OF

Quoted 4 lines
Quoted 4 lines
arch/arm/common/edma.c +2 -0
+	},
+	.probe = edma_probe,
 };
 
Quoted 8 lines

arch/arm/common/edma.c static int __init edma_init(void) · line 1551

Quoted 6 lines
arch/arm/common/edma.c +0 -1
 static int __init edma_init(void)
@@ -1548,4 +1777,3 @@ static int __init edma_init(void)
 	return platform_driver_probe(&edma_driver, edma_probe);
 }
 arch_initcall(edma_init);
-

Stray change I believe.

checkpatch found that bad whitespace.

Quoted 42 lines
Quoted 34 lines
arch/arm/include/asm/mach/edma.h +4 -4
index 7e84c90..ce5f6f8 100644
@@ -237,8 +237,8 @@ void edma_resume(unsigned channel);
 
 struct edma_rsv_info {
 
-	const s16	(*rsv_chans)[2];
-	const s16	(*rsv_slots)[2];
+	s16		(*rsv_chans)[2];
+	s16		(*rsv_slots)[2];
 };
 
 /* platform_data for EDMA driver */
@@ -260,8 +260,8 @@ struct edma_soc_info {
 	/* Resource reservation for other cores */
 	struct edma_rsv_info	*rsv;
 
-	const s8	(*queue_tc_mapping)[2];
-	const s8	(*queue_priority_mapping)[2];
+	s8	(*queue_tc_mapping)[2];
+	s8	(*queue_priority_mapping)[2];
 };
 
 #endif
Signature · 6 lines
1.7.9.5

_______________________________________________
Davinci-linux-open-source mailing list
[email protected]
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source

Regards,
Gururaja
_______________________________________________
Davinci-linux-open-source mailing list
[email protected]
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source

#14 lore raw

RFC PATCH 4/13 dmaengine: edma: enable build for AM335x

In reply to Matt Porter

Enable config option on OMAP and adjust the
private EDMA API header to match the move
of the private EDMA API out of mach-davinci/

---
 drivers/dma/Kconfig |    2 +-
 drivers/dma/edma.c  |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/dma/Kconfig +1 -1
index 0351719..24cd403 100644
@@ -210,7 +210,7 @@ config SIRF_DMA
 
 config TI_EDMA
 	tristate "TI EDMA support"
-	depends on ARCH_DAVINCI
+	depends on ARCH_DAVINCI || ARCH_OMAP
 	select DMA_ENGINE
 	select DMA_VIRTUAL_CHANNELS
 	default n
drivers/dma/edma.c +1 -1
index fdcf079..9f8f2fa 100644
@@ -24,7 +24,7 @@
 #include <linux/slab.h>
 #include <linux/spinlock.h>
 
-#include <mach/edma.h>
+#include <asm/mach/edma.h>
 
 #include "dmaengine.h"
 #include "virt-dma.h"
Signature · 1 line
1.7.9.5
#15 lore raw

RFC PATCH 5/13 dma: Add TI EDMA device tree binding

In reply to Matt Porter

The binding definition is based on the generic DMA controller binding.

---
 Documentation/devicetree/bindings/dma/ti-edma.txt |   49 +++++++++++++++++++++
 1 file changed, 49 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/dma/ti-edma.txt
Documentation/devicetree/bindings/dma/ti-edma.txt new file +49 -0
new file mode 100644
index 0000000..06402eb
@@ -0,0 +1,49 @@
+TI EDMA
+
+Required properties:
+- compatible : "ti,edma3"
+- ti,hwmods: Name of the hwmods associated to the EDMA
+- ti,edma-regions: Number of regions
+- ti,edma-slots: Number of slots
+- ti,edma-queue-tc-map: List of transfer control to queue mappings
+- ti,edma-queue-priority-map: List of queue priority mappings
+- ti,edma-default-queue: Default queue value
+
+Optional properties:
+- ti,edma-reserved-channels: List of reserved channel regions
+- ti,edma-reserved-slots: List of reserved slot regions
+
+Example:
+
+edma: edma at 49000000 {
+	#address-cells = <1>;
+	#size-cells = <0>;
+	reg = <0x49000000 0x10000>;
+	interrupt-parent = <&intc>;
+	interrupts = <12 13 14>;
+	compatible = "ti,edma3";
+	ti,hwmods = "tpcc", "tptc0", "tptc1", "tptc2";
+	#dma-cells = <1>;
+	dma-channels = <64>;
+	ti,edma-regions = <4>;
+	ti,edma-slots = <256>;
+	ti,edma-reserved-channels = <0  2
+				     14 2
+				     26 6
+				     48 4
+				     56 8>;
+	ti,edma-reserved-slots = <0  2
+				  14 2
+				  26 6
+				  48 4
+				  56 8
+				  64 127>;
+	ti,edma-queue-tc-map = <0 0
+				1 1
+				2 2>;
+	ti,edma-queue-priority-map = <0 0
+				      1 1
+				      2 2>;
+	ti,edma-default-queue = <0>;
+};
+
Signature · 1 line
1.7.9.5
#16 lore raw

RE: [RFC PATCH 05/13] dma: Add TI EDMA device tree binding

Quoted 25 lines · Matt

The binding definition is based on the generic DMA controller binding.

---
 Documentation/devicetree/bindings/dma/ti-edma.txt |   49 +++++++++++++++++++++
 1 file changed, 49 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/dma/ti-edma.txt
Documentation/devicetree/bindings/dma/ti-edma.txt new file +10 -0
new file mode 100644
index 0000000..06402eb
@@ -0,0 +1,49 @@
+TI EDMA
+
+Required properties:
+- compatible : "ti,edma3"
+- ti,hwmods: Name of the hwmods associated to the EDMA
+- ti,edma-regions: Number of regions
+- ti,edma-slots: Number of slots
+- ti,edma-queue-tc-map: List of transfer control to queue mappings
+- ti,edma-queue-priority-map: List of queue priority mappings
+- ti,edma-default-queue: Default queue value

Documentation/devicetree/bindings/dma/ti-edma.txt line 20

Quoted 10 lines
Documentation/devicetree/bindings/dma/ti-edma.txt new file +10 -0
+
+Optional properties:
+- ti,edma-reserved-channels: List of reserved channel regions
+- ti,edma-reserved-slots: List of reserved slot regions
+
+Example:
+
+edma: edma at 49000000 {
+	#address-cells = <1>;
+	#size-cells = <0>;

address-cells & size-cells are only required when current node is a parent node & it has sibling/child nodes (that too if the child node uses "reg" property).

Quoted 37 lines
Documentation/devicetree/bindings/dma/ti-edma.txt new file +29 -0
+	reg = <0x49000000 0x10000>;
+	interrupt-parent = <&intc>;
+	interrupts = <12 13 14>;
+	compatible = "ti,edma3";
+	ti,hwmods = "tpcc", "tptc0", "tptc1", "tptc2";
+	#dma-cells = <1>;
+	dma-channels = <64>;
+	ti,edma-regions = <4>;
+	ti,edma-slots = <256>;
+	ti,edma-reserved-channels = <0  2
+				     14 2
+				     26 6
+				     48 4
+				     56 8>;
+	ti,edma-reserved-slots = <0  2
+				  14 2
+				  26 6
+				  48 4
+				  56 8
+				  64 127>;
+	ti,edma-queue-tc-map = <0 0
+				1 1
+				2 2>;
+	ti,edma-queue-priority-map = <0 0
+				      1 1
+				      2 2>;
+	ti,edma-default-queue = <0>;
+};
+
Signature · 6 lines
1.7.9.5

_______________________________________________
Davinci-linux-open-source mailing list
Davinci-linux-open-source at linux.davincidsp.com
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source

Regards,
Gururaja

#17 lore raw

Re: [RFC PATCH 05/13] dma: Add TI EDMA device tree binding

Quoted 32 lines · Gururaja
Quoted 31 lines · Matt

The binding definition is based on the generic DMA controller binding.

---
 Documentation/devicetree/bindings/dma/ti-edma.txt |   49 +++++++++++++++++++++
 1 file changed, 49 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/dma/ti-edma.txt
Documentation/devicetree/bindings/dma/ti-edma.txt new file +16 -0
new file mode 100644
index 0000000..06402eb
@@ -0,0 +1,49 @@
+TI EDMA
+
+Required properties:
+- compatible : "ti,edma3"
+- ti,hwmods: Name of the hwmods associated to the EDMA
+- ti,edma-regions: Number of regions
+- ti,edma-slots: Number of slots
+- ti,edma-queue-tc-map: List of transfer control to queue mappings
+- ti,edma-queue-priority-map: List of queue priority mappings
+- ti,edma-default-queue: Default queue value
+
+Optional properties:
+- ti,edma-reserved-channels: List of reserved channel regions
+- ti,edma-reserved-slots: List of reserved slot regions
+
+Example:
Quoted 8 lines

Documentation/devicetree/bindings/dma/ti-edma.txt line 20

Quoted 4 lines
Documentation/devicetree/bindings/dma/ti-edma.txt new file +4 -0
+
+edma: edma@49000000 {
+	#address-cells = <1>;
+	#size-cells = <0>;

address-cells & size-cells are only required when current node is a parent node & it has sibling/child nodes (that too if the child node uses "reg" property).

Ok. will drop that in v2.

Quoted 47 lines
Quoted 39 lines
Documentation/devicetree/bindings/dma/ti-edma.txt new file +29 -0
+	reg = <0x49000000 0x10000>;
+	interrupt-parent = <&intc>;
+	interrupts = <12 13 14>;
+	compatible = "ti,edma3";
+	ti,hwmods = "tpcc", "tptc0", "tptc1", "tptc2";
+	#dma-cells = <1>;
+	dma-channels = <64>;
+	ti,edma-regions = <4>;
+	ti,edma-slots = <256>;
+	ti,edma-reserved-channels = <0  2
+				     14 2
+				     26 6
+				     48 4
+				     56 8>;
+	ti,edma-reserved-slots = <0  2
+				  14 2
+				  26 6
+				  48 4
+				  56 8
+				  64 127>;
+	ti,edma-queue-tc-map = <0 0
+				1 1
+				2 2>;
+	ti,edma-queue-priority-map = <0 0
+				      1 1
+				      2 2>;
+	ti,edma-default-queue = <0>;
+};
+
Signature · 6 lines
1.7.9.5

_______________________________________________
Davinci-linux-open-source mailing list
[email protected]
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source

Regards,
Gururaja
_______________________________________________
Davinci-linux-open-source mailing list
[email protected]
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source

#18 lore raw

RFC PATCH 6/13 ARM: omap: add hsmmc am33xx specific init

In reply to Matt Porter

AM33xx requires special handling in hsmmc initialization platform glue.

---
 arch/arm/mach-omap2/hsmmc.c |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
arch/arm/mach-omap2/hsmmc.c +4 -3
index a9675d8..679fb43 100644
@@ -364,7 +364,7 @@ static int __init omap_hsmmc_pdata_init(struct omap2_hsmmc_info *c,
 	else
 		mmc->slots[0].ocr_mask = c->ocr_mask;
 
-	if (!soc_is_am35xx())
+	if (!soc_is_am35xx() && !soc_is_am33xx())
 		mmc->slots[0].features |= HSMMC_HAS_PBIAS;
 
 	if (cpu_is_omap44xx() && (omap_rev() > OMAP4430_REV_ES1_0))
@@ -387,7 +387,7 @@ static int __init omap_hsmmc_pdata_init(struct omap2_hsmmc_info *c,
 			}
 		}
 
-		if (soc_is_am35xx())
+		if (soc_is_am35xx() || soc_is_am33xx())
 			mmc->slots[0].set_power = nop_mmc_set_power;
 
 		/* OMAP3630 HSMMC1 supports only 4-bit */
@@ -488,7 +488,8 @@ static void __init omap_hsmmc_init_one(struct omap2_hsmmc_info *hsmmcinfo,
 	if (res < 0)
 		goto free_mmc;
 
-	omap_hsmmc_mux(mmc_data, (ctrl_nr - 1));
+	if (!soc_is_am33xx())
+		omap_hsmmc_mux(mmc_data, (ctrl_nr - 1));
 
 	name = "omap_hsmmc";
 	res = snprintf(oh_name, MAX_OMAP_MMC_HWMOD_NAME_LEN,
Signature · 1 line
1.7.9.5
#19 lore raw

RFC PATCH 7/13 mmc: omap_hsmmc: dma_request_slave_channel() support for DT platforms

In reply to Matt Porter

For platforms with DT populated, use dma_request_slave_channel() to acquire the DMA channel. For !DT platforms, we fall back to explicitly passing the omap_dma_filter_fn() to dma_request_channel(). Once all platforms boot from DT, the dma_request_channel() path can be dropped.

---
 drivers/mmc/host/omap_hsmmc.c |   16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)
drivers/mmc/host/omap_hsmmc.c +14 -2
index 3a09f93..c82d0ab 100644
@@ -1923,14 +1923,26 @@ static int __devinit omap_hsmmc_probe(struct platform_device *pdev)
 	dma_cap_zero(mask);
 	dma_cap_set(DMA_SLAVE, mask);
 
-	host->rx_chan = dma_request_channel(mask, omap_dma_filter_fn, &rx_req);
+	if (pdev->dev.of_node)
+		host->rx_chan =
+			dma_request_slave_channel(&pdev->dev, "rx");
+	else
+		host->rx_chan = dma_request_channel(mask,
+						    omap_dma_filter_fn,
+						    &rx_req);
 	if (!host->rx_chan) {
 		dev_err(mmc_dev(host->mmc), "unable to obtain RX DMA engine channel %u\n", rx_req);
 		ret = -ENXIO;
 		goto err_irq;
 	}
 
-	host->tx_chan = dma_request_channel(mask, omap_dma_filter_fn, &tx_req);
+	if (pdev->dev.of_node)
+		host->tx_chan =
+			dma_request_slave_channel(&pdev->dev, "tx");
+	else
+		host->tx_chan = dma_request_channel(mask,
+						    omap_dma_filter_fn,
+						    &tx_req);
 	if (!host->tx_chan) {
 		dev_err(mmc_dev(host->mmc), "unable to obtain TX DMA engine channel %u\n", tx_req);
 		ret = -ENXIO;
Signature · 1 line
1.7.9.5
maintainer
#20 lore raw

Re: [RFC PATCH 07/13] mmc: omap_hsmmc: dma_request_slave_channel() support for DT platforms

Quoted 35 lines · Matt Porter

For platforms with DT populated, use dma_request_slave_channel() to acquire the DMA channel. For !DT platforms, we fall back to explicitly passing the omap_dma_filter_fn() to dma_request_channel(). Once all platforms boot from DT, the dma_request_channel() path can be dropped.

---
 drivers/mmc/host/omap_hsmmc.c |   16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)
drivers/mmc/host/omap_hsmmc.c +7 -2
index 3a09f93..c82d0ab 100644
@@ -1923,14 +1923,26 @@ static int __devinit omap_hsmmc_probe(struct platform_device *pdev)
 	dma_cap_zero(mask);
 	dma_cap_set(DMA_SLAVE, mask);
 
-	host->rx_chan = dma_request_channel(mask, omap_dma_filter_fn, &rx_req);
+	if (pdev->dev.of_node)
+		host->rx_chan =
+			dma_request_slave_channel(&pdev->dev, "rx");
+	else
+		host->rx_chan = dma_request_channel(mask,
+						    omap_dma_filter_fn,
+						    &rx_req);
 	if (!host->rx_chan) {
 		dev_err(mmc_dev(host->mmc), "unable to obtain RX DMA engine channel %u\n", rx_req);
 		ret = -ENXIO;
 		goto err_irq;
 	}
 
-	host->tx_chan = dma_request_channel(mask, omap_dma_filter_fn, &tx_req);

drivers/mmc/host/omap_hsmmc.c static int __devinit omap_hsmmc_probe(struct platform_device *pdev) · line 1948

Quoted 10 lines
drivers/mmc/host/omap_hsmmc.c +7 -0
+	if (pdev->dev.of_node)
+		host->tx_chan =
+			dma_request_slave_channel(&pdev->dev, "tx");
+	else
+		host->tx_chan = dma_request_channel(mask,
+						    omap_dma_filter_fn,
+						    &tx_req);
 	if (!host->tx_chan) {
 		dev_err(mmc_dev(host->mmc), "unable to obtain TX DMA engine channel %u\n", tx_req);
 		ret = -ENXIO;

Here to the omap_hsmmc.c driver should not need to care about which way to request the dma channels.

Regards,

Tony

#21 lore raw

RFC PATCH 8/13 mmc: omap_hsmmc: limit max_segs with the EDMA DMAC

In reply to Matt Porter

The EDMA DMAC has a hardware limitation that prevents supporting scatter gather lists with any number of segments. Since the EDMA DMA Engine driver sets the maximum segments to 16, we do the same.

Note: this can be removed once the DMA Engine API supports an API to query the DMAC's segment limitations.

---
 drivers/mmc/host/omap_hsmmc.c |   10 ++++++++++
 1 file changed, 10 insertions(+)
drivers/mmc/host/omap_hsmmc.c +10 -0
index c82d0ab..61b54ee 100644
@@ -1885,6 +1885,16 @@ static int __devinit omap_hsmmc_probe(struct platform_device *pdev)
 	 * as we want. */
 	mmc->max_segs = 1024;
 
+	/* Eventually we should get our max_segs limitation for EDMA by
+	 * querying the dmaengine API */
+	if (pdev->dev.of_node) {
+		struct device_node *parent = pdev->dev.of_node->parent;
+		struct device_node *node;
+		node = of_find_node_by_name(parent, "edma");
+		if (node)
+			mmc->max_segs = 16;
+	}
+
 	mmc->max_blk_size = 512;       /* Block Length at max can be 1024 */
 	mmc->max_blk_count = 0xFFFF;    /* No. of Blocks is 16 bits */
 	mmc->max_req_size = mmc->max_blk_size * mmc->max_blk_count;
Signature · 1 line
1.7.9.5
#22 lore raw

Re: [RFC PATCH 08/13] mmc: omap_hsmmc: limit max_segs with the EDMA DMAC

Quoted 8 lines · Matt Porter

The EDMA DMAC has a hardware limitation that prevents supporting scatter gather lists with any number of segments. Since the EDMA DMA Engine driver sets the maximum segments to 16, we do the same.

Note: this can be removed once the DMA Engine API supports an API to query the DMAC's segment limitations.

I wouldn't want to bind the properties of EDMA to omap_hsmmc as this patch suggests. Why don't we have a max_segs property, which when explicitly specified in DT, will override the default ?

#23 lore raw

Re: [RFC PATCH 08/13] mmc: omap_hsmmc: limit max_segs with the EDMA DMAC

Quoted 6 lines · Venkatraman
Quoted 5 lines · Matt Porter

The EDMA DMAC has a hardware limitation that prevents supporting scatter gather lists with any number of segments. Since the EDMA DMA Engine driver sets the maximum segments to 16, we do the same.

Quoted 7 lines
Quoted 3 lines

Note: this can be removed once the DMA Engine API supports an API to query the DMAC's segment limitations.

I wouldn't want to bind the properties of EDMA to omap_hsmmc as this patch suggests. Why don't we have a max_segs property, which when explicitly specified in DT, will override the default ?

If you are adventurous, this can be a generic mmc DT binding instead of restricting it to OMAP.

#24 lore raw

Re: [RFC PATCH 08/13] mmc: omap_hsmmc: limit max_segs with the EDMA DMAC

Quoted 11 lines · Venkatraman
Quoted 10 lines · Venkatraman
Quoted 8 lines · Matt Porter

The EDMA DMAC has a hardware limitation that prevents supporting scatter gather lists with any number of segments. Since the EDMA DMA Engine driver sets the maximum segments to 16, we do the same.

Note: this can be removed once the DMA Engine API supports an API to query the DMAC's segment limitations.

Quoted 6 lines
Quoted 3 lines

I wouldn't want to bind the properties of EDMA to omap_hsmmc as this patch suggests. Why don't we have a max_segs property, which when explicitly specified in DT, will override the default ?

If you are adventurous, this can be a generic mmc DT binding instead of restricting it to OMAP.

I say if it's a limitation in the DMAC, then DMAC's driver should handle it, no ? Meaning that in this case you would copy from one multi-segment sg into a one-segment sg and when transfer is complete, before calling user's callback, copy data the other way around (?)

Signature · 8 lines
balbi
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20120921/822b7e47/attachment.sig>
#25 lore raw

Re: [RFC PATCH 08/13] mmc: omap_hsmmc: limit max_segs with the EDMA DMAC

Quoted 16 lines · Felipe Balbi
Quoted 15 lines · Venkatraman
Quoted 13 lines · Venkatraman
Quoted 8 lines · Matt Porter

The EDMA DMAC has a hardware limitation that prevents supporting scatter gather lists with any number of segments. Since the EDMA DMA Engine driver sets the maximum segments to 16, we do the same.

Note: this can be removed once the DMA Engine API supports an API to query the DMAC's segment limitations.

I wouldn't want to bind the properties of EDMA to omap_hsmmc as this patch suggests. Why don't we have a max_segs property, which when explicitly specified in DT, will override the default ?

Quoted 8 lines
Quoted 2 lines

If you are adventurous, this can be a generic mmc DT binding instead of restricting it to OMAP.

I say if it's a limitation in the DMAC, then DMAC's driver should handle it, no ? Meaning that in this case you would copy from one multi-segment sg into a one-segment sg and when transfer is complete, before calling user's callback, copy data the other way around (?)

Right ! So even if the property is defined for MMC, Matt will end up coding the limitation into every peripheral driver that uses EMAC, which doesn't scale. Your solution is better.

#26 lore raw

Re: [RFC PATCH 08/13] mmc: omap_hsmmc: limit max_segs with the EDMA DMAC

In reply to Felipe Balbi
Quoted 16 lines · Felipe Balbi
Quoted 15 lines · Venkatraman
Quoted 13 lines · Venkatraman
Quoted 8 lines · Matt Porter

The EDMA DMAC has a hardware limitation that prevents supporting scatter gather lists with any number of segments. Since the EDMA DMA Engine driver sets the maximum segments to 16, we do the same.

Note: this can be removed once the DMA Engine API supports an API to query the DMAC's segment limitations.

I wouldn't want to bind the properties of EDMA to omap_hsmmc as this patch suggests. Why don't we have a max_segs property, which when explicitly specified in DT, will override the default ?

Quoted 7 lines
Quoted 2 lines

If you are adventurous, this can be a generic mmc DT binding instead of restricting it to OMAP.

I say if it's a limitation in the DMAC, then DMAC's driver should handle it, no ? Meaning that in this case you would copy from one multi-segment sg into a one-segment sg and when transfer is complete, before calling user's callback, copy data the other way around (?)

With this DMAC, we would have to do a CPU-based copy or a series of smaller DMA-based 16 segment copies with completion interrupts in between.

The reason the EDMA DMA Engine driver sets this limit is that we have a hardware limitation preventing setting up a large multi-segment transfer. The limitation is set by how many EDMA PaRaM slots are available (varies based on how the hwmod is instantiated) but on AM335x it's 256. You can't use all of those for just one slave device and so the EDMA dmaengine driver arbitrarily hardcodes (atm) 16 as the max any one channel can claim. Even if you could use all of them, it's common for an unrestricted scatter gather transfer to exceed even our best case hardware limitation.

This is a case where asking the DMA Engine driver to handle any length SG is going to result in a big peformance hit, since the MMC subsystem provides this hook for a reason, we just need the proper DMA Engine API to find out how to set it.

So I guess I'm going to need to write up an API proposal unless Vinod has already been thinking about this...

-Matt

#27 lore raw

Re: [RFC PATCH 08/13] mmc: omap_hsmmc: limit max_segs with the EDMA DMAC

In reply to S, Venkatraman
Quoted 11 lines · Venkatraman
Quoted 10 lines · Venkatraman
Quoted 8 lines · Matt Porter

The EDMA DMAC has a hardware limitation that prevents supporting scatter gather lists with any number of segments. Since the EDMA DMA Engine driver sets the maximum segments to 16, we do the same.

Note: this can be removed once the DMA Engine API supports an API to query the DMAC's segment limitations.

Quoted 6 lines
Quoted 3 lines

I wouldn't want to bind the properties of EDMA to omap_hsmmc as this patch suggests. Why don't we have a max_segs property, which when explicitly specified in DT, will override the default ?

If you are adventurous, this can be a generic mmc DT binding instead of restricting it to OMAP.

I think it's bad practice to add something to a binding that is not part of the hardware definition for the device. In this case, the limitations comes strictly from the DMAC. As I noted, the proper fix for this is to have the DMA Engine API extended to allow querying the DMAC SG capabilities before setting up a DMA transfer. I brought this up previously in the thread where the actual EDMA dmaengine wrapper driver was discussed and Vinod indicated that he was open to dmaengine providing this information.

It makes sense as DMA Engine should tell the slave driver everything it needs to know to set up a transfer...this is just a missing piece right now. FWIW, we have this issue in davinci_mmc.c as well...it just was already hardcoded with a value to satisfy the EDMA DMAC. However, I'd like to see that go away as well.

-Matt

#28 lore raw

Re: [RFC PATCH 08/13] mmc: omap_hsmmc: limit max_segs with the EDMA DMAC

In reply to S, Venkatraman
Quoted 6 lines · Venkatraman
Quoted 5 lines · Matt Porter

The EDMA DMAC has a hardware limitation that prevents supporting scatter gather lists with any number of segments. Since the EDMA DMA Engine driver sets the maximum segments to 16, we do the same.

Quoted 7 lines
Quoted 3 lines

Note: this can be removed once the DMA Engine API supports an API to query the DMAC's segment limitations.

I wouldn't want to bind the properties of EDMA to omap_hsmmc as this patch suggests. Why don't we have a max_segs property, which when explicitly specified in DT, will override the default ?

Why not have a generic way that DMA engine can export these kinds of properties?

#29 lore raw

Re: [RFC PATCH 08/13] mmc: omap_hsmmc: limit max_segs with the EDMA DMAC

Quoted 11 lines · Russell King
Quoted 10 lines · Venkatraman
Quoted 8 lines · Matt Porter

The EDMA DMAC has a hardware limitation that prevents supporting scatter gather lists with any number of segments. Since the EDMA DMA Engine driver sets the maximum segments to 16, we do the same.

Note: this can be removed once the DMA Engine API supports an API to query the DMAC's segment limitations.

Quoted 6 lines
Quoted 3 lines

I wouldn't want to bind the properties of EDMA to omap_hsmmc as this patch suggests. Why don't we have a max_segs property, which when explicitly specified in DT, will override the default ?

Why not have a generic way that DMA engine can export these kinds of properties?

That's exactly what my note above is suggesting...

Something along the lines of:

	struct slave_sg_caps
	{
		int max_segs;	/* <0 is no limit */
	}

	struct slave_sg_cap *
	dmaengine_get_slave_sg_caps(struct dma_chan *chan);

I'm sure there are or will be other characteristics worth providing to slave drivers.

-Matt

#30 lore raw

Re: [RFC PATCH 08/13] mmc: omap_hsmmc: limit max_segs with the EDMA DMAC

In reply to Russell King - ARM Linux
Quoted 11 lines · Russell King - ARM Linux
Quoted 10 lines · Venkatraman
Quoted 8 lines · Matt Porter

The EDMA DMAC has a hardware limitation that prevents supporting scatter gather lists with any number of segments. Since the EDMA DMA Engine driver sets the maximum segments to 16, we do the same.

Note: this can be removed once the DMA Engine API supports an API to query the DMAC's segment limitations.

Quoted 6 lines
Quoted 3 lines

I wouldn't want to bind the properties of EDMA to omap_hsmmc as this patch suggests. Why don't we have a max_segs property, which when explicitly specified in DT, will override the default ?

Why not have a generic way that DMA engine can export these kinds of properties?

We discussed this at KS. I was of opinion that DMA engine should export controller and channel capabilities as part of the channel it returns.

Some folks had an opinion that they already know how to use controller so may not be very helpful, but if it is going to help (which I think), i have a patch for this :)

Signature · 1 line
~Vinod
#31 lore raw

Re: [RFC PATCH 08/13] mmc: omap_hsmmc: limit max_segs with the EDMA DMAC

Quoted 16 lines · Vinod Koul
Quoted 15 lines · Russell King - ARM Linux
Quoted 13 lines · Venkatraman
Quoted 8 lines · Matt Porter

The EDMA DMAC has a hardware limitation that prevents supporting scatter gather lists with any number of segments. Since the EDMA DMA Engine driver sets the maximum segments to 16, we do the same.

Note: this can be removed once the DMA Engine API supports an API to query the DMAC's segment limitations.

I wouldn't want to bind the properties of EDMA to omap_hsmmc as this patch suggests. Why don't we have a max_segs property, which when explicitly specified in DT, will override the default ?

Quoted 8 lines
Quoted 2 lines

Why not have a generic way that DMA engine can export these kinds of properties?

We discussed this at KS. I was of opinion that DMA engine should export controller and channel capabilities as part of the channel it returns.

Some folks had an opinion that they already know how to use controller so may not be very helpful, but if it is going to help (which I think), i have a patch for this :)

Anything you can show at this point? ;) I'd be happy to drop the half-hack for a real API. If not, I'm going to carry that to v2 atm.

-Matt

#32 lore raw

Re: [RFC PATCH 08/13] mmc: omap_hsmmc: limit max_segs with the EDMA DMAC

Quoted 3 lines · Matt Porter

Anything you can show at this point? ;) I'd be happy to drop the half-hack
for a real API. If not, I'm going to carry that to v2 atm.

This is what I had done sometime back. Feel free to update....

include/linux/dmaengine.h +44 -5
index 9c02a45..94ae006 100644
@@ -86,11 +86,11 @@ enum dma_transaction_type {
  * @DMA_DEV_TO_DEV: Slave mode & From Device to Device
  */
 enum dma_transfer_direction {
-	DMA_MEM_TO_MEM,
-	DMA_MEM_TO_DEV,
-	DMA_DEV_TO_MEM,
-	DMA_DEV_TO_DEV,
-	DMA_TRANS_NONE,
+	DMA_MEM_TO_MEM	= 0x01,
+	DMA_MEM_TO_DEV	= 0x02,
+	DMA_DEV_TO_MEM	= 0x04,
+	DMA_DEV_TO_DEV	= 0x08,
+	DMA_TRANS_NONE	= 0x10,
 };
 
 /**
@@ -371,6 +371,41 @@ struct dma_slave_config {
 	unsigned int slave_id;
 };
 
+enum dmaengine_apis {
+	DMAENGINE_MEMCPY	= 0x0001,
+	DMAENGINE_XOR		= 0x0002,
+	DMAENGINE_XOR_VAL	= 0x0004,
+	DMAENGINE_PQ		= 0x0008,
+	DMAENGINE_PQ_VAL	= 0x0010,
+	DMAENGINE_MEMSET	= 0x0020,
+	DMAENGINE_SLAVE		= 0x0040,
+	DMAENGINE_CYCLIC	= 0x0080,
+	DMAENGINE_INTERLEAVED	= 0x0100,
+	DMAENGINE_SG		= 0x0200,
+};
+
+/* struct dmaengine_chan_caps - expose capability of a channel
+ * Note: each channel can have same or different capabilities
+ *
+ * This primarily classifies capabilities into
+ * a) APIs/ops supported
+ * b) channel physical capabilities
+ *
+ * @ops: or'ed api capability
+ * @widths: channel widths supported
+ * @dirn: channel directions supported
+ * @bursts: bitmask of burst lengths supported
+ * @mux: configurable slave id or hard wired
+ * 	-1 for hard wired, otherwise valid positive slave id (including zero)
+ */
+struct dmaengine_chan_caps {
+	enum dmaengine_apis	ops;
+	enum dma_slave_buswidth widths;
+	enum dma_transfer_direction dirn;
+	unsigned int dma_bursts;
+	int mux;
+};
+
 static inline const char *dma_chan_name(struct dma_chan *chan)
 {
 	return dev_name(&chan->dev->device);
@@ -534,6 +569,7 @@ struct dma_tx_state {
  *	struct with auxiliary transfer status information, otherwise the call
  *	will just return a simple status code
  * @device_issue_pending: push pending transactions to hardware
+ * @device_channel_caps: return the capablities of channel
  */
 struct dma_device {
 
@@ -602,6 +638,9 @@ struct dma_device {
 					    dma_cookie_t cookie,
 					    struct dma_tx_state *txstate);
 	void (*device_issue_pending)(struct dma_chan *chan);
+
+	struct dmaengine_chan_caps *(*device_channel_caps)(
+		struct dma_chan *chan);
 };
 
 static inline int dmaengine_device_control(struct dma_chan *chan,
Signature · 1 line
~Vinod
#33 lore raw

RFC PATCH 9/13 mmc: omap_hsmmc: add generic DMA request support to the DT binding

In reply to Matt Porter

The binding definition is based on the generic DMA request binding.

---
 .../devicetree/bindings/mmc/ti-omap-hsmmc.txt      |   25 +++++++++++++++++++-
 1 file changed, 24 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/mmc/ti-omap-hsmmc.txt +24 -1
index be76a23..d1b8932 100644
@@ -19,8 +19,28 @@ ti,dual-volt: boolean, supports dual voltage cards
 "supply-name" examples are "vmmc", "vmmc_aux" etc
 ti,non-removable: non-removable slot (like eMMC)
 ti,needs-special-reset: Requires a special softreset sequence
+dmas: DMA controller phandle and DMA request value ordered pair
+One tx and one rx pair is required.
+dma-names: DMA request names. These strings correspond 1:1 with
+the ordered pairs in dmas. The RX request must be "rx" and the
+TX request must be "tx".
+
+Examples:
+
+[hwmod populated DMA resources]
+
+	mmc1: mmc at 0x4809c000 {
+		compatible = "ti,omap4-hsmmc";
+		reg = <0x4809c000 0x400>;
+		ti,hwmods = "mmc1";
+		ti,dual-volt;
+		bus-width = <4>;
+		vmmc-supply = <&vmmc>; /* phandle to regulator node */
+		ti,non-removable;
+	};
+
+[generic DMA request binding]
 
-Example:
 	mmc1: mmc at 0x4809c000 {
 		compatible = "ti,omap4-hsmmc";
 		reg = <0x4809c000 0x400>;
@@ -29,4 +49,7 @@ Example:
 		bus-width = <4>;
 		vmmc-supply = <&vmmc>; /* phandle to regulator node */
 		ti,non-removable;
+		dmas = <&edma 24
+			&edma 25>;
+		dma-names = "tx", "rx";
 	};
Signature · 1 line
1.7.9.5
#34 lore raw

RFC PATCH 10/13 spi: omap2-mcspi: dma_request_slave_channel() support for DT platforms

In reply to Matt Porter

For platforms with DT populated, use dma_request_slave_channel() to acquire the DMA channel. For !DT platforms, we fall back to explicitly passing the omap_dma_filter_fn() to dma_request_channel(). Once all platforms boot from DT, the dma_request_channel() path can be dropped.

---
 drivers/spi/spi-omap2-mcspi.c |   68 +++++++++++++++++++++++++++++------------
 1 file changed, 48 insertions(+), 20 deletions(-)
drivers/spi/spi-omap2-mcspi.c +48 -20
index 9502566..1cf1072 100644
@@ -104,6 +104,9 @@ struct omap2_mcspi_dma {
 
 	struct completion dma_tx_completion;
 	struct completion dma_rx_completion;
+
+	char dma_rx_ch_name[14];
+	char dma_tx_ch_name[14];
 };
 
 /* use PIO for small transfers, avoiding DMA setup/teardown overhead and
@@ -798,14 +801,26 @@ static int omap2_mcspi_request_dma(struct spi_device *spi)
 	dma_cap_zero(mask);
 	dma_cap_set(DMA_SLAVE, mask);
 	sig = mcspi_dma->dma_rx_sync_dev;
-	mcspi_dma->dma_rx = dma_request_channel(mask, omap_dma_filter_fn, &sig);
+	if (spi->dev.of_node)
+		mcspi_dma->dma_rx =
+			dma_request_slave_channel(&master->dev,
+						  mcspi_dma->dma_rx_ch_name);
+	else
+		mcspi_dma->dma_rx =
+			dma_request_channel(mask, omap_dma_filter_fn, &sig);
 	if (!mcspi_dma->dma_rx) {
 		dev_err(&spi->dev, "no RX DMA engine channel for McSPI\n");
 		return -EAGAIN;
 	}
 
 	sig = mcspi_dma->dma_tx_sync_dev;
-	mcspi_dma->dma_tx = dma_request_channel(mask, omap_dma_filter_fn, &sig);
+	if (spi->dev.of_node)
+		mcspi_dma->dma_tx =
+			dma_request_slave_channel(&master->dev,
+						  mcspi_dma->dma_tx_ch_name);
+	else
+		mcspi_dma->dma_tx =
+			dma_request_channel(mask, omap_dma_filter_fn, &sig);
 	if (!mcspi_dma->dma_tx) {
 		dev_err(&spi->dev, "no TX DMA engine channel for McSPI\n");
 		dma_release_channel(mcspi_dma->dma_rx);
@@ -1194,29 +1209,42 @@ static int __devinit omap2_mcspi_probe(struct platform_device *pdev)
 		goto free_master;
 
 	for (i = 0; i < master->num_chipselect; i++) {
-		char dma_ch_name[14];
+		char *dma_rx_ch_name = mcspi->dma_channels[i].dma_rx_ch_name;
+		char *dma_tx_ch_name = mcspi->dma_channels[i].dma_tx_ch_name;
 		struct resource *dma_res;
 
-		sprintf(dma_ch_name, "rx%d", i);
-		dma_res = platform_get_resource_byname(pdev, IORESOURCE_DMA,
-							dma_ch_name);
-		if (!dma_res) {
-			dev_dbg(&pdev->dev, "cannot get DMA RX channel\n");
-			status = -ENODEV;
-			break;
-		}
+		sprintf(dma_rx_ch_name, "rx%d", i);
+		if (!pdev->dev.of_node) {
+			dma_res =
+				platform_get_resource_byname(pdev,
+							     IORESOURCE_DMA,
+							     dma_rx_ch_name);
+			if (!dma_res) {
+				dev_dbg(&pdev->dev,
+					"cannot get DMA RX channel\n");
+				status = -ENODEV;
+				break;
+			}
 
-		mcspi->dma_channels[i].dma_rx_sync_dev = dma_res->start;
-		sprintf(dma_ch_name, "tx%d", i);
-		dma_res = platform_get_resource_byname(pdev, IORESOURCE_DMA,
-							dma_ch_name);
-		if (!dma_res) {
-			dev_dbg(&pdev->dev, "cannot get DMA TX channel\n");
-			status = -ENODEV;
-			break;
+			mcspi->dma_channels[i].dma_rx_sync_dev =
+				dma_res->start;
 		}
+		sprintf(dma_tx_ch_name, "tx%d", i);
+		if (!pdev->dev.of_node) {
+			dma_res =
+				platform_get_resource_byname(pdev,
+							     IORESOURCE_DMA,
+							     dma_tx_ch_name);
+			if (!dma_res) {
+				dev_dbg(&pdev->dev,
+					"cannot get DMA TX channel\n");
+				status = -ENODEV;
+				break;
+			}
 
-		mcspi->dma_channels[i].dma_tx_sync_dev = dma_res->start;
+			mcspi->dma_channels[i].dma_tx_sync_dev =
+				dma_res->start;
+		}
 	}
 
 	if (status < 0)
Signature · 1 line
1.7.9.5
maintainer
#35 lore raw

Re: [RFC PATCH 10/13] spi: omap2-mcspi: dma_request_slave_channel() support for DT platforms

Quoted 32 lines · Matt Porter

For platforms with DT populated, use dma_request_slave_channel() to acquire the DMA channel. For !DT platforms, we fall back to explicitly passing the omap_dma_filter_fn() to dma_request_channel(). Once all platforms boot from DT, the dma_request_channel() path can be dropped.

---
 drivers/spi/spi-omap2-mcspi.c |   68 +++++++++++++++++++++++++++++------------
 1 file changed, 48 insertions(+), 20 deletions(-)
drivers/spi/spi-omap2-mcspi.c +5 -1
index 9502566..1cf1072 100644
@@ -104,6 +104,9 @@ struct omap2_mcspi_dma {
 
 	struct completion dma_tx_completion;
 	struct completion dma_rx_completion;
+
+	char dma_rx_ch_name[14];
+	char dma_tx_ch_name[14];
 };
 
 /* use PIO for small transfers, avoiding DMA setup/teardown overhead and
@@ -798,14 +801,26 @@ static int omap2_mcspi_request_dma(struct spi_device *spi)
 	dma_cap_zero(mask);
 	dma_cap_set(DMA_SLAVE, mask);
 	sig = mcspi_dma->dma_rx_sync_dev;
-	mcspi_dma->dma_rx = dma_request_channel(mask, omap_dma_filter_fn, &sig);
+	if (spi->dev.of_node)
+		mcspi_dma->dma_rx =

drivers/spi/spi-omap2-mcspi.c static int omap2_mcspi_request_dma(struct spi_device *spi) · line 815

Quoted 10 lines
drivers/spi/spi-omap2-mcspi.c +5 -0
+			dma_request_slave_channel(&master->dev,
+						  mcspi_dma->dma_rx_ch_name);
+	else
+		mcspi_dma->dma_rx =
+			dma_request_channel(mask, omap_dma_filter_fn, &sig);
 	if (!mcspi_dma->dma_rx) {
 		dev_err(&spi->dev, "no RX DMA engine channel for McSPI\n");
 		return -EAGAIN;
 	}
 

Hmm this does not look nice.. We should be able to somehow not to care about the configuration at the mcspi driver level.

Regards,

Tony

#36 lore raw

Re: [RFC PATCH 10/13] spi: omap2-mcspi: dma_request_slave_channel() support for DT platforms

Quoted 13 lines · Tony Lindgren
Quoted 13 lines

/* use PIO for small transfers, avoiding DMA setup/teardown overhead and

drivers/spi/spi-omap2-mcspi.c +7 -1
@@ -798,14 +801,26 @@ static int omap2_mcspi_request_dma(struct spi_device *spi)
      dma_cap_zero(mask);
      dma_cap_set(DMA_SLAVE, mask);
      sig = mcspi_dma->dma_rx_sync_dev;
-     mcspi_dma->dma_rx = dma_request_channel(mask, omap_dma_filter_fn, &sig);
+     if (spi->dev.of_node)
+             mcspi_dma->dma_rx =
+                     dma_request_slave_channel(&master->dev,
+                                               mcspi_dma->dma_rx_ch_name);
+     else
+             mcspi_dma->dma_rx =
+                     dma_request_channel(mask, omap_dma_filter_fn, &sig);
Quoted 8 lines

drivers/spi/spi-omap2-mcspi.c static int omap2_mcspi_request_dma(struct spi_device *spi) · line 815

Quoted 5 lines
drivers/spi/spi-omap2-mcspi.c +0 -0
      if (!mcspi_dma->dma_rx) {
              dev_err(&spi->dev, "no RX DMA engine channel for McSPI\n");
              return -EAGAIN;
      }
 

Hmm this does not look nice.. We should be able to somehow not to care about the configuration at the mcspi driver level.

I agree, but as far as I understand Vinod's plans, we would actually move all drivers over to dma_request_slave_channel() when we have an interface to register the lookup tables from platform code.

I think the above is ok for a transitional phase and we can remove the fallback path when we have converted all platforms using this driver to either use DT or move to the new style way of passing the channel configuration.

Arnd

maintainer
#37 lore raw

Re: [RFC PATCH 10/13] spi: omap2-mcspi: dma_request_slave_channel() support for DT platforms

Quoted 23 lines · Arnd Bergmann
Quoted 13 lines · Tony Lindgren
Quoted 13 lines

/* use PIO for small transfers, avoiding DMA setup/teardown overhead and

drivers/spi/spi-omap2-mcspi.c +7 -1
@@ -798,14 +801,26 @@ static int omap2_mcspi_request_dma(struct spi_device *spi)
      dma_cap_zero(mask);
      dma_cap_set(DMA_SLAVE, mask);
      sig = mcspi_dma->dma_rx_sync_dev;
-     mcspi_dma->dma_rx = dma_request_channel(mask, omap_dma_filter_fn, &sig);
+     if (spi->dev.of_node)
+             mcspi_dma->dma_rx =
+                     dma_request_slave_channel(&master->dev,
+                                               mcspi_dma->dma_rx_ch_name);
+     else
+             mcspi_dma->dma_rx =
+                     dma_request_channel(mask, omap_dma_filter_fn, &sig);
Quoted 8 lines

drivers/spi/spi-omap2-mcspi.c static int omap2_mcspi_request_dma(struct spi_device *spi) · line 815

Quoted 5 lines
drivers/spi/spi-omap2-mcspi.c +0 -0
      if (!mcspi_dma->dma_rx) {
              dev_err(&spi->dev, "no RX DMA engine channel for McSPI\n");
              return -EAGAIN;
      }
 

Hmm this does not look nice.. We should be able to somehow not to care about the configuration at the mcspi driver level.

Quoted 8 lines

I agree, but as far as I understand Vinod's plans, we would actually move all drivers over to dma_request_slave_channel() when we have an interface to register the lookup tables from platform code.

I think the above is ok for a transitional phase and we can remove the fallback path when we have converted all platforms using this driver to either use DT or move to the new style way of passing the channel configuration.

Can't we come up with a version of dma_request_slave_channel that works both ways for now:

	mcspi_dma->dma_rx =
		dma_request_slave_channel_compat(mask, omap_dma_filter_fn, &sig,
					&master->dev, mcspi_dma->dma_rx_ch_name);
	...			

Then it's just question of patching away two lines later on rather than having to add all this if else to all the drivers first, then patching it away again.

Regards,

Tony

#38 lore raw

Re: [RFC PATCH 10/13] spi: omap2-mcspi: dma_request_slave_channel() support for DT platforms

Quoted 36 lines · Tony Lindgren
Quoted 23 lines · Arnd Bergmann
Quoted 13 lines · Tony Lindgren
Quoted 13 lines

/* use PIO for small transfers, avoiding DMA setup/teardown overhead and

drivers/spi/spi-omap2-mcspi.c +7 -1
@@ -798,14 +801,26 @@ static int omap2_mcspi_request_dma(struct spi_device *spi)
      dma_cap_zero(mask);
      dma_cap_set(DMA_SLAVE, mask);
      sig = mcspi_dma->dma_rx_sync_dev;
-     mcspi_dma->dma_rx = dma_request_channel(mask, omap_dma_filter_fn, &sig);
+     if (spi->dev.of_node)
+             mcspi_dma->dma_rx =
+                     dma_request_slave_channel(&master->dev,
+                                               mcspi_dma->dma_rx_ch_name);
+     else
+             mcspi_dma->dma_rx =
+                     dma_request_channel(mask, omap_dma_filter_fn, &sig);
Quoted 8 lines

drivers/spi/spi-omap2-mcspi.c static int omap2_mcspi_request_dma(struct spi_device *spi) · line 815

Quoted 5 lines
drivers/spi/spi-omap2-mcspi.c +0 -0
      if (!mcspi_dma->dma_rx) {
              dev_err(&spi->dev, "no RX DMA engine channel for McSPI\n");
              return -EAGAIN;
      }
 

Hmm this does not look nice.. We should be able to somehow not to care about the configuration at the mcspi driver level.

Quoted 8 lines

I agree, but as far as I understand Vinod's plans, we would actually move all drivers over to dma_request_slave_channel() when we have an interface to register the lookup tables from platform code.

I think the above is ok for a transitional phase and we can remove the fallback path when we have converted all platforms using this driver to either use DT or move to the new style way of passing the channel configuration.

Can't we come up with a version of dma_request_slave_channel that works both ways for now:

Quoted 8 lines
	mcspi_dma->dma_rx =
		dma_request_slave_channel_compat(mask, omap_dma_filter_fn, &sig,
					&master->dev, mcspi_dma->dma_rx_ch_name);
	...			

Then it's just question of patching away two lines later on rather than having to add all this if else to all the drivers first, then patching it away again.

I think that something like that is workable with the implementation simply checking for of_node to do the right thing.

-Matt

#39 lore raw

Re: [RFC PATCH 10/13] spi: omap2-mcspi: dma_request_slave_channel() support for DT platforms

Quoted 10 lines · Matt Porter
Quoted 9 lines · Tony Lindgren

Can't we come up with a version of dma_request_slave_channel that works both ways for now:

	mcspi_dma->dma_rx =
		dma_request_slave_channel_compat(mask, omap_dma_filter_fn, &sig,
					&master->dev, mcspi_dma->dma_rx_ch_name);
	...			
Quoted 6 lines
Quoted 3 lines

Then it's just question of patching away two lines later on rather than having to add all this if else to all the drivers first, then patching it away again.

I think that something like that is workable with the implementation simply checking for of_node to do the right thing.

Yes, I think it would be better to have common API but underneath two implementations in transitional phase.

Signature · 1 line
~Vinod
#40 lore raw

Re: [RFC PATCH 10/13] spi: omap2-mcspi: dma_request_slave_channel() support for DT platforms

Quoted 11 lines · Vinod Koul
Quoted 10 lines · Matt Porter
Quoted 9 lines · Tony Lindgren

Can't we come up with a version of dma_request_slave_channel that works both ways for now:

	mcspi_dma->dma_rx =
		dma_request_slave_channel_compat(mask, omap_dma_filter_fn, &sig,
					&master->dev, mcspi_dma->dma_rx_ch_name);
	...			
Quoted 8 lines
Quoted 6 lines
Quoted 3 lines

Then it's just question of patching away two lines later on rather than having to add all this if else to all the drivers first, then patching it away again.

I think that something like that is workable with the implementation simply checking for of_node to do the right thing.

Yes, I think it would be better to have common API but underneath two implementations in transitional phase.

Ok, I'll implement something for discussion in the v2 series.

-Matt

#41 lore raw

RFC PATCH 11/13 spi: omap2-mcspi: add generic DMA request support to the DT binding

In reply to Matt Porter

The binding definition is based on the generic DMA request binding.

---
 Documentation/devicetree/bindings/spi/omap-spi.txt |   27 +++++++++++++++++++-
 1 file changed, 26 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/spi/omap-spi.txt +26 -1
index 81df374..11aff04 100644
@@ -7,8 +7,18 @@ Required properties:
 - ti,spi-num-cs : Number of chipselect supported  by the instance.
 - ti,hwmods: Name of the hwmod associated to the McSPI
 
+Optional properties:
+- dmas: List of DMA controller phandle and DMA request ordered
+	pairs. One tx and one rx pair is required for each chip
+	select.
+- dma-names: List of DMA request names. These strings correspond
+	1:1 with the ordered pairs in dmas. The string naming is
+	to be "rxN" and "txN" for RX and TX requests,
+	respectively, where N equals the chip select number.
 
-Example:
+Examples:
+
+[hwmod populated DMA resources]
 
 mcspi1: mcspi@1 {
     #address-cells = <1>;
@@ -18,3 +28,18 @@ mcspi1: mcspi@1 {
     ti,spi-num-cs = <4>;
 };
 
+[generic DMA request binding]
+
+mcspi1: mcspi@1 {
+    #address-cells = <1>;
+    #size-cells = <0>;
+    compatible = "ti,omap4-mcspi";
+    ti,hwmods = "mcspi1";
+    ti,spi-num-cs = <2>;
+    dmas = <&edma 42
+	    &edma 43
+	    &edma 44
+	    &edma 45>;
+    dma-names = "tx0", "rx0", "tx1", "rx1";
+};
+
Signature · 1 line
1.7.9.5
#42 lore raw

RFC PATCH 12/13 ARM: dts: add am33xx EDMA support

In reply to Matt Porter

Adds support for the defined EDMA, generic DMA controller, and DMA request bindings for mmc and spi.

---
 arch/arm/boot/dts/am33xx.dtsi |   46 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 46 insertions(+)
arch/arm/boot/dts/am33xx.dtsi +46 -0
index e8033eb..c14a61d 100644
@@ -86,6 +86,36 @@
 			reg = <0x48200000 0x1000>;
 		};
 
+		edma: edma@49000000 {
+			compatible = "ti,edma3";
+			ti,hwmods = "tpcc", "tptc0", "tptc1", "tptc2";
+			reg = <0x49000000 0x10000>;
+			interrupt-parent = <&intc>;
+			interrupts = <12 13 14>;
+			#dma-cells = <1>;
+			dma-channels = <64>;
+			ti,edma-regions = <4>;
+			ti,edma-slots = <256>;
+			ti,edma-reserved-channels = <0  2
+					     14 2
+					     26 6
+					     48 4
+					     56 8>;
+			ti,edma-reserved-slots = <0  2
+					  14 2
+					  26 6
+					  48 4
+					  56 8
+					  64 127>;
+			ti,edma-queue-tc-map = <0 0
+					1 1
+					2 2>;
+			ti,edma-queue-priority-map = <0 0
+					      1 1
+					      2 2>;
+			ti,edma-default-queue = <0>;
+		};
+
 		gpio0: gpio@44e07000 {
 			compatible = "ti,omap4-gpio";
 			ti,hwmods = "gpio1";
@@ -290,6 +320,9 @@
 			ti,hwmods = "mmc1";
 			ti,dual-volt;
 			ti,needs-special-reset;
+			dmas = <&edma 24
+				&edma 25>;
+			dma-names = "tx", "rx";
 		};
 
 		mmc2: mmc@481D8000 {
@@ -297,6 +330,9 @@
 			ti,hwmods = "mmc2";
 			ti,needs-special-reset;
 			status = "disabled";
+			dmas = <&edma 2
+				&edma 3>;
+			dma-names = "tx", "rx";
 		};
 
 		mmc3: mmc@47810000 {
@@ -339,6 +375,11 @@
 			reg = <0x48030000 0x400>;
 			interrupt-parent = <&intc>;
 			interrupt = <65>;
+			dmas = <&edma 16
+				&edma 17
+				&edma 18
+				&edma 19>;
+			dma-names = "tx0", "rx0", "tx1", "rx1";
 			ti,spi-num-cs = <2>;
 			ti,hwmods = "spi0";
 			status = "disabled";
@@ -351,6 +392,11 @@
 			reg = <0x481a0000 0x400>;
 			interrupt-parent = <&intc>;
 			interrupt = <125>;
+			dmas = <&edma 42
+				&edma 43
+				&edma 44
+				&edma 45>;
+			dma-names = "tx0", "rx0", "tx1", "rx1";
 			ti,spi-num-cs = <2>;
 			ti,hwmods = "spi1";
 			status = "disabled";
Signature · 1 line
1.7.9.5
#43 lore raw

RFC PATCH 13/13 Documentation: add schedule for removing private EDMA API

In reply to Matt Porter

The davinci-pcm driver is the last in-kernel user of the private EDMA API. Once it has been converted to DMA Engine API the private EDMA API functionality can be folded into the EDMA DMA Engine driver and removed.

---
 Documentation/feature-removal-schedule.txt |   10 ++++++++++
 1 file changed, 10 insertions(+)
Documentation/feature-removal-schedule.txt +10 -0
index f4d8c71..64109e6 100644
@@ -637,3 +637,13 @@ Who:	Russell King <[email protected]>,
 	Santosh Shilimkar <[email protected]>
 
 ----------------------------
+
+What:	EDMA private DMA implementation
+When:	2013
+Why:	We have a DMA engine implementation; all users should be updated
+	to use this rather than persisting with the old APIs.  The old APIs
+	block merging the old DMA engine implementation into the DMA
+	engine driver.
+Who:	Matt Porter <[email protected]>
+
+----------------------------
Signature · 1 line
1.7.9.5
#44 lore raw

Re: [RFC PATCH 13/13] Documentation: add schedule for removing private EDMA API

Quoted 2 lines · Matt Porter
 Documentation/feature-removal-schedule.txt |   10 ++++++++++
 1 file changed, 10 insertions(+)

We decided at kernel summit that we'd stop bothering with this, it's mostly just bitrot and rarely read. I guess the ASoC driver update isn't ready yet?

#45 lore raw

Re: [RFC PATCH 13/13] Documentation: add schedule for removing private EDMA API

Quoted 8 lines · Mark Brown
Quoted 2 lines · Matt Porter
 Documentation/feature-removal-schedule.txt |   10 ++++++++++
 1 file changed, 10 insertions(+)

We decided at kernel summit that we'd stop bothering with this, it's mostly just bitrot and rarely read. I guess the ASoC driver update isn't ready yet?

Ok, I'll drop this from the series.

No, I'm just getting real time now to work on the davinci-pcm dma engine conversion and cyclic dma support for edma. That driver is somewhat of a mess as it has some older platforms dependent on SRAM-based ping-pong buffering and that all need to be sorted during this. It is the only remaining blocker though for getting rid of the private API.

-Matt

#46 lore raw
In reply to Matt Porter
Quoted 36 lines · Matt

This series adds DMA Engine support for AM33xx, which uses an EDMA DMAC. The EDMA DMAC has been previously supported by only a private API implementation (much like the situation with OMAP DMA) found on the DaVinci family of SoCs.

There are a mind-boggling number of dependencies for this series:

- Jon Hunter's OF DMA helpers series
https://patchwork.kernel.org/patch/1461061/
https://patchwork.kernel.org/patch/1461051/
- Patch to address OF DMA helpers naming issues:
https://patchwork.kernel.org/patch/1477921/
- EDMA DMA Engine wrapper driver in linux-next c2dde5f8f2095d7c623ff3565c1462e190272273
- EDMA DMA Engine wrapper driver bug fix:
https://patchwork.kernel.org/patch/1474411/
- A huge number of patches in linux-next for AM33xx boot (too numerous to list)

The approach taken is similar to how OMAP DMA is being converted to DMA Engine support. With the functional EDMA private API already existing in mach-davinci/dma.c, we first move that to an ARM common area so it can be shared. Adding DT and runtime PM support to the private EDMA API implementation allows it to run on AM33xx. AM33xx *only* boots using DT so we leverage Jon's generic DT DMA helpers to register EDMA DMAC with the of_dma framework and then add support for calling the dma_request_slave_channel() API to both the mmc and spi drivers.

What works? Well, with this series we now have MMC and SPI support on AM33xx. The only caveat for MMC is that the mmc3 controller has its events on the crossbar and is not usable right now.

This is tested on BeagleBone with a SPI framebuffer driver and SD card.

Quoted 9 lines

After this series, the plan is to convert the last in-tree user of the private EDMA API (davinci-pcm/mcasp) and then eliminate the private EDMA API by folding its functionality into drivers/dma/edma.c.

TODO:
add AM33xx crossbar support to the private EDMA API (any EDMA events on the crossbar are not supported)

Can you please mention the base repo you have taken as starting point. (repo + extra patches ...).

This will help us to test the code.

This is because I looked at the patch 12/13 and I see that mmc device-node is modified. But in mainline I don?t see device node for mmc (yet).

Quoted 41 lines

Matt Porter (13):
ARM: davinci: move private EDMA API to arm/common
ARM: edma: remove unused transfer controller handlers
ARM: edma: add DT and runtime PM support for AM335x
dmaengine: edma: enable build for AM335x
dma: Add TI EDMA device tree binding
ARM: omap: add hsmmc am33xx specific init
mmc: omap_hsmmc: dma_request_slave_channel() support for DT platforms
mmc: omap_hsmmc: limit max_segs with the EDMA DMAC
mmc: omap_hsmmc: add generic DMA request support to the DT binding
spi: omap2-mcspi: dma_request_slave_channel() support for DT
platforms
spi: omap2-mcspi: add generic DMA request support to the DT binding
ARM: dts: add am33xx EDMA support
Documentation: add schedule for removing private EDMA API

 Documentation/devicetree/bindings/dma/ti-edma.txt  |   49 +
 .../devicetree/bindings/mmc/ti-omap-hsmmc.txt      |   25 +-
 Documentation/devicetree/bindings/spi/omap-spi.txt |   27 +-
 Documentation/feature-removal-schedule.txt         |   10 +
 arch/arm/Kconfig                                   |    1 +
 arch/arm/boot/dts/am33xx.dtsi                      |   46 +
 arch/arm/common/Kconfig                            |    3 +
 arch/arm/common/Makefile                           |    1 +
 arch/arm/common/edma.c                             | 1779 ++++++++++++++++++++
 arch/arm/include/asm/mach/edma.h                   |  267 +++
 arch/arm/mach-davinci/Makefile                     |    2 +-
 arch/arm/mach-davinci/devices.c                    |    3 +-
 arch/arm/mach-davinci/dm355.c                      |    2 +-
 arch/arm/mach-davinci/dm365.c                      |    2 +-
 arch/arm/mach-davinci/dm644x.c                     |    2 +-
 arch/arm/mach-davinci/dm646x.c                     |    2 +-
 arch/arm/mach-davinci/dma.c                        | 1588 -----------------
 arch/arm/mach-davinci/include/mach/asp.h           |    2 +-
 arch/arm/mach-davinci/include/mach/da8xx.h         |    3 +-
 arch/arm/mach-davinci/include/mach/edma.h          |  267 ---
 arch/arm/mach-davinci/include/mach/spi.h           |    2 +-
 arch/arm/mach-omap2/hsmmc.c                        |    7 +-
 arch/arm/plat-omap/Kconfig                         |    1 +
 drivers/dma/Kconfig                                |    2 +-
 drivers/dma/edma.c                                 |    2 +-
Quoted 17 lines
 drivers/mmc/host/omap_hsmmc.c                      |   26 +-
 drivers/spi/spi-omap2-mcspi.c                      |   68 +-
 27 files changed, 2296 insertions(+), 1893 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/dma/ti-edma.txt
 create mode 100644 arch/arm/common/edma.c
 create mode 100644 arch/arm/include/asm/mach/edma.h
 delete mode 100644 arch/arm/mach-davinci/dma.c
 delete mode 100644 arch/arm/mach-davinci/include/mach/edma.h
Signature · 6 lines
1.7.9.5

_______________________________________________
Davinci-linux-open-source mailing list
Davinci-linux-open-source at linux.davincidsp.com
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source

Regards,
Gururaja

#47 lore raw
Quoted 42 lines · Gururaja
Quoted 41 lines · Matt

This series adds DMA Engine support for AM33xx, which uses an EDMA DMAC. The EDMA DMAC has been previously supported by only a private API implementation (much like the situation with OMAP DMA) found on the DaVinci family of SoCs.

There are a mind-boggling number of dependencies for this series:

- Jon Hunter's OF DMA helpers series
https://patchwork.kernel.org/patch/1461061/
https://patchwork.kernel.org/patch/1461051/
- Patch to address OF DMA helpers naming issues:
https://patchwork.kernel.org/patch/1477921/
- EDMA DMA Engine wrapper driver in linux-next c2dde5f8f2095d7c623ff3565c1462e190272273
- EDMA DMA Engine wrapper driver bug fix:
https://patchwork.kernel.org/patch/1474411/
- A huge number of patches in linux-next for AM33xx boot (too numerous to list)

The approach taken is similar to how OMAP DMA is being converted to DMA Engine support. With the functional EDMA private API already existing in mach-davinci/dma.c, we first move that to an ARM common area so it can be shared. Adding DT and runtime PM support to the private EDMA API implementation allows it to run on AM33xx. AM33xx *only* boots using DT so we leverage Jon's generic DT DMA helpers to register EDMA DMAC with the of_dma framework and then add support for calling the dma_request_slave_channel() API to both the mmc and spi drivers.

What works? Well, with this series we now have MMC and SPI support on AM33xx. The only caveat for MMC is that the mmc3 controller has its events on the crossbar and is not usable right now.

This is tested on BeagleBone with a SPI framebuffer driver and SD card.

After this series, the plan is to convert the last in-tree user of the private EDMA API (davinci-pcm/mcasp) and then eliminate the private EDMA API by folding its functionality into drivers/dma/edma.c.

Quoted 8 lines
Quoted 4 lines

TODO:
add AM33xx crossbar support to the private EDMA API (any EDMA events on the crossbar are not supported)

Can you please mention the base repo you have taken as starting point. (repo + extra patches ...).

It's mainline 3.6-rc6 and you can see the complete set of patches at https://github.com/ohporter/linux/tree/edma-dmaengine-am33xx-rfc-v1
after commit 5698bd757d55b1bb87edd1a9744ab09c142abfc2

Quoted 5 lines

This will help us to test the code.

This is because I looked at the patch 12/13 and I see that mmc device-node is modified. But in mainline I don’t see device node for mmc (yet).

Oops. You'll need e62a3333ae450bcdefbe22229d7bc277ae0ef645 and fe97304557d2c6f7d0aaf1ea028ea48ffca366a9 which I forgot to include in this series. I'll have them in for v2.

-Matt

Quoted 66 lines
Quoted 41 lines

Matt Porter (13):
ARM: davinci: move private EDMA API to arm/common
ARM: edma: remove unused transfer controller handlers
ARM: edma: add DT and runtime PM support for AM335x
dmaengine: edma: enable build for AM335x
dma: Add TI EDMA device tree binding
ARM: omap: add hsmmc am33xx specific init
mmc: omap_hsmmc: dma_request_slave_channel() support for DT platforms
mmc: omap_hsmmc: limit max_segs with the EDMA DMAC
mmc: omap_hsmmc: add generic DMA request support to the DT binding
spi: omap2-mcspi: dma_request_slave_channel() support for DT
platforms
spi: omap2-mcspi: add generic DMA request support to the DT binding
ARM: dts: add am33xx EDMA support
Documentation: add schedule for removing private EDMA API

 Documentation/devicetree/bindings/dma/ti-edma.txt  |   49 +
 .../devicetree/bindings/mmc/ti-omap-hsmmc.txt      |   25 +-
 Documentation/devicetree/bindings/spi/omap-spi.txt |   27 +-
 Documentation/feature-removal-schedule.txt         |   10 +
 arch/arm/Kconfig                                   |    1 +
 arch/arm/boot/dts/am33xx.dtsi                      |   46 +
 arch/arm/common/Kconfig                            |    3 +
 arch/arm/common/Makefile                           |    1 +
 arch/arm/common/edma.c                             | 1779 ++++++++++++++++++++
 arch/arm/include/asm/mach/edma.h                   |  267 +++
 arch/arm/mach-davinci/Makefile                     |    2 +-
 arch/arm/mach-davinci/devices.c                    |    3 +-
 arch/arm/mach-davinci/dm355.c                      |    2 +-
 arch/arm/mach-davinci/dm365.c                      |    2 +-
 arch/arm/mach-davinci/dm644x.c                     |    2 +-
 arch/arm/mach-davinci/dm646x.c                     |    2 +-
 arch/arm/mach-davinci/dma.c                        | 1588 -----------------
 arch/arm/mach-davinci/include/mach/asp.h           |    2 +-
 arch/arm/mach-davinci/include/mach/da8xx.h         |    3 +-
 arch/arm/mach-davinci/include/mach/edma.h          |  267 ---
 arch/arm/mach-davinci/include/mach/spi.h           |    2 +-
 arch/arm/mach-omap2/hsmmc.c                        |    7 +-
 arch/arm/plat-omap/Kconfig                         |    1 +
 drivers/dma/Kconfig                                |    2 +-
 drivers/dma/edma.c                                 |    2 +-
Quoted 17 lines
 drivers/mmc/host/omap_hsmmc.c                      |   26 +-
 drivers/spi/spi-omap2-mcspi.c                      |   68 +-
 27 files changed, 2296 insertions(+), 1893 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/dma/ti-edma.txt
 create mode 100644 arch/arm/common/edma.c
 create mode 100644 arch/arm/include/asm/mach/edma.h
 delete mode 100644 arch/arm/mach-davinci/dma.c
 delete mode 100644 arch/arm/mach-davinci/include/mach/edma.h
Signature · 6 lines
1.7.9.5

_______________________________________________
Davinci-linux-open-source mailing list
[email protected]
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source

Regards,
Gururaja
_______________________________________________
Davinci-linux-open-source mailing list
[email protected]
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source

#48 lore raw
Quoted 49 lines · Matt
Quoted 48 lines · Gururaja
Quoted 45 lines · Matt

This series adds DMA Engine support for AM33xx, which uses an EDMA DMAC. The EDMA DMAC has been previously supported by only a private API implementation (much like the situation with OMAP DMA) found on the DaVinci family of SoCs.

There are a mind-boggling number of dependencies for this series:

- Jon Hunter's OF DMA helpers series
https://patchwork.kernel.org/patch/1461061/
https://patchwork.kernel.org/patch/1461051/
- Patch to address OF DMA helpers naming issues:
https://patchwork.kernel.org/patch/1477921/
- EDMA DMA Engine wrapper driver in linux-next c2dde5f8f2095d7c623ff3565c1462e190272273
- EDMA DMA Engine wrapper driver bug fix:
https://patchwork.kernel.org/patch/1474411/
- A huge number of patches in linux-next for AM33xx boot (too numerous to list)

The approach taken is similar to how OMAP DMA is being converted to DMA Engine support. With the functional EDMA private API already existing in mach-davinci/dma.c, we first move that to an ARM common area so it can be shared. Adding DT and runtime PM support to the private EDMA API implementation allows it to run on AM33xx. AM33xx *only* boots using DT so we leverage Jon's generic DT DMA helpers to register EDMA DMAC with the of_dma framework and then add support for calling the dma_request_slave_channel() API to both the mmc and spi drivers.

What works? Well, with this series we now have MMC and SPI support on AM33xx. The only caveat for MMC is that the mmc3 controller has its events on the crossbar and is not usable right now.

This is tested on BeagleBone with a SPI framebuffer driver and SD card.

After this series, the plan is to convert the last in-tree user of the private EDMA API (davinci-pcm/mcasp) and then eliminate the private EDMA API by folding its functionality into drivers/dma/edma.c.

TODO:
add AM33xx crossbar support to the private EDMA API (any EDMA events on the crossbar are not supported)

Quoted 6 lines
Quoted 2 lines

Can you please mention the base repo you have taken as starting point. (repo + extra patches ...).

It's mainline 3.6-rc6 and you can see the complete set of patches at https://github.com/ohporter/linux/tree/edma-dmaengine-am33xx-rfc-v1
after commit 5698bd757d55b1bb87edd1a9744ab09c142abfc2

Thanks for the link. However, I was looking for the mainline kernel repo/branch That you first used as baseline.

Quoted 7 lines
Quoted 6 lines

This will help us to test the code.

This is because I looked at the patch 12/13 and I see that mmc device-node is modified. But in mainline I don?t see device node for mmc (yet).

Quoted 73 lines

Oops. You'll need e62a3333ae450bcdefbe22229d7bc277ae0ef645 and fe97304557d2c6f7d0aaf1ea028ea48ffca366a9 which I forgot to include in this series. I'll have them in for v2.

-Matt

Quoted 66 lines
Quoted 41 lines

Matt Porter (13):
ARM: davinci: move private EDMA API to arm/common
ARM: edma: remove unused transfer controller handlers
ARM: edma: add DT and runtime PM support for AM335x
dmaengine: edma: enable build for AM335x
dma: Add TI EDMA device tree binding
ARM: omap: add hsmmc am33xx specific init
mmc: omap_hsmmc: dma_request_slave_channel() support for DT platforms
mmc: omap_hsmmc: limit max_segs with the EDMA DMAC
mmc: omap_hsmmc: add generic DMA request support to the DT binding
spi: omap2-mcspi: dma_request_slave_channel() support for DT
platforms
spi: omap2-mcspi: add generic DMA request support to the DT binding
ARM: dts: add am33xx EDMA support
Documentation: add schedule for removing private EDMA API

 Documentation/devicetree/bindings/dma/ti-edma.txt  |   49 +
 .../devicetree/bindings/mmc/ti-omap-hsmmc.txt      |   25 +-
 Documentation/devicetree/bindings/spi/omap-spi.txt |   27 +-
 Documentation/feature-removal-schedule.txt         |   10 +
 arch/arm/Kconfig                                   |    1 +
 arch/arm/boot/dts/am33xx.dtsi                      |   46 +
 arch/arm/common/Kconfig                            |    3 +
 arch/arm/common/Makefile                           |    1 +
 arch/arm/common/edma.c                             | 1779 ++++++++++++++++++++
 arch/arm/include/asm/mach/edma.h                   |  267 +++
 arch/arm/mach-davinci/Makefile                     |    2 +-
 arch/arm/mach-davinci/devices.c                    |    3 +-
 arch/arm/mach-davinci/dm355.c                      |    2 +-
 arch/arm/mach-davinci/dm365.c                      |    2 +-
 arch/arm/mach-davinci/dm644x.c                     |    2 +-
 arch/arm/mach-davinci/dm646x.c                     |    2 +-
 arch/arm/mach-davinci/dma.c                        | 1588 -----------------
 arch/arm/mach-davinci/include/mach/asp.h           |    2 +-
 arch/arm/mach-davinci/include/mach/da8xx.h         |    3 +-
 arch/arm/mach-davinci/include/mach/edma.h          |  267 ---
 arch/arm/mach-davinci/include/mach/spi.h           |    2 +-
 arch/arm/mach-omap2/hsmmc.c                        |    7 +-
 arch/arm/plat-omap/Kconfig                         |    1 +
 drivers/dma/Kconfig                                |    2 +-
 drivers/dma/edma.c                                 |    2 +-
Quoted 17 lines
 drivers/mmc/host/omap_hsmmc.c                      |   26 +-
 drivers/spi/spi-omap2-mcspi.c                      |   68 +-
 27 files changed, 2296 insertions(+), 1893 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/dma/ti-edma.txt
 create mode 100644 arch/arm/common/edma.c
 create mode 100644 arch/arm/include/asm/mach/edma.h
 delete mode 100644 arch/arm/mach-davinci/dma.c
 delete mode 100644 arch/arm/mach-davinci/include/mach/edma.h
Signature · 6 lines
1.7.9.5

_______________________________________________
Davinci-linux-open-source mailing list
Davinci-linux-open-source at linux.davincidsp.com
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source

Regards,
Gururaja
_______________________________________________
Davinci-linux-open-source mailing list
Davinci-linux-open-source at linux.davincidsp.com
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source

Regards,
Gururaja

#49 lore raw
Quoted 53 lines · Gururaja
Quoted 52 lines · Matt
Quoted 50 lines · Gururaja
Quoted 36 lines · Matt

This series adds DMA Engine support for AM33xx, which uses an EDMA DMAC. The EDMA DMAC has been previously supported by only a private API implementation (much like the situation with OMAP DMA) found on the DaVinci family of SoCs.

There are a mind-boggling number of dependencies for this series:

- Jon Hunter's OF DMA helpers series
https://patchwork.kernel.org/patch/1461061/
https://patchwork.kernel.org/patch/1461051/
- Patch to address OF DMA helpers naming issues:
https://patchwork.kernel.org/patch/1477921/
- EDMA DMA Engine wrapper driver in linux-next c2dde5f8f2095d7c623ff3565c1462e190272273
- EDMA DMA Engine wrapper driver bug fix:
https://patchwork.kernel.org/patch/1474411/
- A huge number of patches in linux-next for AM33xx boot (too numerous to list)

The approach taken is similar to how OMAP DMA is being converted to DMA Engine support. With the functional EDMA private API already existing in mach-davinci/dma.c, we first move that to an ARM common area so it can be shared. Adding DT and runtime PM support to the private EDMA API implementation allows it to run on AM33xx. AM33xx *only* boots using DT so we leverage Jon's generic DT DMA helpers to register EDMA DMAC with the of_dma framework and then add support for calling the dma_request_slave_channel() API to both the mmc and spi drivers.

What works? Well, with this series we now have MMC and SPI support on AM33xx. The only caveat for MMC is that the mmc3 controller has its events on the crossbar and is not usable right now.

This is tested on BeagleBone with a SPI framebuffer driver and SD card.

Quoted 9 lines

After this series, the plan is to convert the last in-tree user of the private EDMA API (davinci-pcm/mcasp) and then eliminate the private EDMA API by folding its functionality into drivers/dma/edma.c.

TODO:
add AM33xx crossbar support to the private EDMA API (any EDMA events on the crossbar are not supported)

Can you please mention the base repo you have taken as starting point. (repo + extra patches ...).

Quoted 7 lines
Quoted 3 lines

It's mainline 3.6-rc6 and you can see the complete set of patches at https://github.com/ohporter/linux/tree/edma-dmaengine-am33xx-rfc-v1
after commit 5698bd757d55b1bb87edd1a9744ab09c142abfc2

Thanks for the link. However, I was looking for the mainline kernel repo/branch That you first used as baseline.

Linus 3.6-rc6 is the baseline. This inital version was created before any of the am33xx base support patches got pulled to linux-next. v2 is being rebased against that to slim down the stack of patches necessary for testing.

Quoted 87 lines
Quoted 6 lines
Quoted 5 lines

This will help us to test the code.

This is because I looked at the patch 12/13 and I see that mmc device-node is modified. But in mainline I don’t see device node for mmc (yet).

Quoted 73 lines

Oops. You'll need e62a3333ae450bcdefbe22229d7bc277ae0ef645 and fe97304557d2c6f7d0aaf1ea028ea48ffca366a9 which I forgot to include in this series. I'll have them in for v2.

-Matt

Quoted 66 lines
Quoted 41 lines

Matt Porter (13):
ARM: davinci: move private EDMA API to arm/common
ARM: edma: remove unused transfer controller handlers
ARM: edma: add DT and runtime PM support for AM335x
dmaengine: edma: enable build for AM335x
dma: Add TI EDMA device tree binding
ARM: omap: add hsmmc am33xx specific init
mmc: omap_hsmmc: dma_request_slave_channel() support for DT platforms
mmc: omap_hsmmc: limit max_segs with the EDMA DMAC
mmc: omap_hsmmc: add generic DMA request support to the DT binding
spi: omap2-mcspi: dma_request_slave_channel() support for DT
platforms
spi: omap2-mcspi: add generic DMA request support to the DT binding
ARM: dts: add am33xx EDMA support
Documentation: add schedule for removing private EDMA API

 Documentation/devicetree/bindings/dma/ti-edma.txt  |   49 +
 .../devicetree/bindings/mmc/ti-omap-hsmmc.txt      |   25 +-
 Documentation/devicetree/bindings/spi/omap-spi.txt |   27 +-
 Documentation/feature-removal-schedule.txt         |   10 +
 arch/arm/Kconfig                                   |    1 +
 arch/arm/boot/dts/am33xx.dtsi                      |   46 +
 arch/arm/common/Kconfig                            |    3 +
 arch/arm/common/Makefile                           |    1 +
 arch/arm/common/edma.c                             | 1779 ++++++++++++++++++++
 arch/arm/include/asm/mach/edma.h                   |  267 +++
 arch/arm/mach-davinci/Makefile                     |    2 +-
 arch/arm/mach-davinci/devices.c                    |    3 +-
 arch/arm/mach-davinci/dm355.c                      |    2 +-
 arch/arm/mach-davinci/dm365.c                      |    2 +-
 arch/arm/mach-davinci/dm644x.c                     |    2 +-
 arch/arm/mach-davinci/dm646x.c                     |    2 +-
 arch/arm/mach-davinci/dma.c                        | 1588 -----------------
 arch/arm/mach-davinci/include/mach/asp.h           |    2 +-
 arch/arm/mach-davinci/include/mach/da8xx.h         |    3 +-
 arch/arm/mach-davinci/include/mach/edma.h          |  267 ---
 arch/arm/mach-davinci/include/mach/spi.h           |    2 +-
 arch/arm/mach-omap2/hsmmc.c                        |    7 +-
 arch/arm/plat-omap/Kconfig                         |    1 +
 drivers/dma/Kconfig                                |    2 +-
 drivers/dma/edma.c                                 |    2 +-
Quoted 17 lines
 drivers/mmc/host/omap_hsmmc.c                      |   26 +-
 drivers/spi/spi-omap2-mcspi.c                      |   68 +-
 27 files changed, 2296 insertions(+), 1893 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/dma/ti-edma.txt
 create mode 100644 arch/arm/common/edma.c
 create mode 100644 arch/arm/include/asm/mach/edma.h
 delete mode 100644 arch/arm/mach-davinci/dma.c
 delete mode 100644 arch/arm/mach-davinci/include/mach/edma.h
Signature · 6 lines
1.7.9.5

_______________________________________________
Davinci-linux-open-source mailing list
[email protected]
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source

Regards,
Gururaja
_______________________________________________
Davinci-linux-open-source mailing list
[email protected]
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source

Regards,
Gururaja
_______________________________________________
Davinci-linux-open-source mailing list
[email protected]
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source

#50 lore raw
In reply to Matt Porter
Quoted 58 lines · Matt
Quoted 42 lines · Gururaja
Quoted 41 lines · Matt

This series adds DMA Engine support for AM33xx, which uses an EDMA DMAC. The EDMA DMAC has been previously supported by only a private API implementation (much like the situation with OMAP DMA) found on the DaVinci family of SoCs.

There are a mind-boggling number of dependencies for this series:

- Jon Hunter's OF DMA helpers series
https://patchwork.kernel.org/patch/1461061/
https://patchwork.kernel.org/patch/1461051/
- Patch to address OF DMA helpers naming issues:
https://patchwork.kernel.org/patch/1477921/
- EDMA DMA Engine wrapper driver in linux-next c2dde5f8f2095d7c623ff3565c1462e190272273
- EDMA DMA Engine wrapper driver bug fix:
https://patchwork.kernel.org/patch/1474411/
- A huge number of patches in linux-next for AM33xx boot (too numerous to list)

The approach taken is similar to how OMAP DMA is being converted to DMA Engine support. With the functional EDMA private API already existing in mach-davinci/dma.c, we first move that to an ARM common area so it can be shared. Adding DT and runtime PM support to the private EDMA API implementation allows it to run on AM33xx. AM33xx *only* boots using DT so we leverage Jon's generic DT DMA helpers to register EDMA DMAC with the of_dma framework and then add support for calling the dma_request_slave_channel() API to both the mmc and spi drivers.

What works? Well, with this series we now have MMC and SPI support on AM33xx. The only caveat for MMC is that the mmc3 controller has its events on the crossbar and is not usable right now.

This is tested on BeagleBone with a SPI framebuffer driver and SD card.

After this series, the plan is to convert the last in-tree user of the private EDMA API (davinci-pcm/mcasp) and then eliminate the private EDMA API by folding its functionality into drivers/dma/edma.c.

Quoted 8 lines
Quoted 4 lines

TODO:
add AM33xx crossbar support to the private EDMA API (any EDMA events on the crossbar are not supported)

Can you please mention the base repo you have taken as starting point. (repo + extra patches ...).

It's mainline 3.6-rc6 and you can see the complete set of patches at https://github.com/ohporter/linux/tree/edma-dmaengine-am33xx-rfc-v1
after commit 5698bd757d55b1bb87edd1a9744ab09c142abfc2

Quoted 2 lines

This will help us to test the code.

Quoted 7 lines
Quoted 3 lines

This is because I looked at the patch 12/13 and I see that mmc device-node is modified. But in mainline I don?t see device node for mmc (yet).

Oops. You'll need e62a3333ae450bcdefbe22229d7bc277ae0ef645 and fe97304557d2c6f7d0aaf1ea028ea48ffca366a9 which I forgot to include in this series. I'll have them in for v2.

Yesterday I tested edma patches on latest linux-next/master + merge of linux-omap/for_3.7/dts_part2. Below are my observations

1. baseline = linux-next/master + merge of linux-omap/for_3.7/dts_part2
2. on top of above branch, I applied patches [1-9]/13 of your edma patches
3. few patches required trivial changes before applying
4. Applied dma of patches as you mentioned
5. add custom patch (ARM: CUSTOM: Build a uImage with dtb already appended)
From https://github.com/hvaibhav/am335x-linux/commit/

        7e72f5ed4b702c9373d19f7626f07ae31a381d53#arch/arm/Makefile

6. Modified 9/13 patch to apply properly on latest am33xx.dtsi.

	a. Edma portion as it is
	b. mmc portion as below
		mmc1: mmc at 48060000 {
			compatible = "ti,omap3-hsmmc";
			ti,hwmods = "mmc1";
			ti,dual-volt;
			ti,needs-special-reset;
			bus-width = <4>;
			vmmc-supply = <&vmmc_reg>;
			dmas = <&edma 24
				&edma 25>;
			dma-names = "tx", "rx";
		};
	c. added mmc pinmux as-well

7. make CROSS_COMPILE=arm-arago-linux-gnueabi- ARCH=arm distclean make CROSS_COMPILE=arm-arago-linux-gnueabi- ARCH=arm omap2plus_defconfig

8. enabled TI_EDMA from menuconfig (since it was not enabled for omap2plus_defconfig

9. make CROSS_COMPILE=arm-arago-linux-gnueabi- ARCH=arm uImage make CROSS_COMPILE=arm-arago-linux-gnueabi- ARCH=arm uImage-dtb.am335x-evm

With above changes, edma probe was failing at request_mem_region() Inside linux-next/arch/arm/common/edma.c --> edma_probe()

I had to modify edma_probe as below

arch/arm/common/edma.c +2 -2
index f337f81..efe2673 100644
@@ -1589,11 +1589,11 @@ static int __init edma_probe(struct platform_device *pdev)
        for (j = 0; j < EDMA_MAX_CC; j++) {
                if (node) {
                        int err;
-                       err = of_address_to_resource(node, 0, &res[j]);
+                       err = of_address_to_resource(node, j, &res[j]);
                        if (err) {
                                dev_err(dev,
                                        "unable to find 'reg' property\n");
-                               return -EIO;
+                               //return -EIO;
                        }
                        r[j] = &res[j];
 

With this I was able to boot on am335x-evm and do a successful MMC copy-md5sum-compare test.

I believe you are looking into above issue in your v2 version.

Quoted 3 lines

-Matt

...snip...
...snip...
...snip...

Regards,
Gururaja

#51 lore raw
Quoted 78 lines · Gururaja
Quoted 58 lines · Matt
Quoted 42 lines · Gururaja
Quoted 41 lines · Matt

This series adds DMA Engine support for AM33xx, which uses an EDMA DMAC. The EDMA DMAC has been previously supported by only a private API implementation (much like the situation with OMAP DMA) found on the DaVinci family of SoCs.

There are a mind-boggling number of dependencies for this series:

- Jon Hunter's OF DMA helpers series
https://patchwork.kernel.org/patch/1461061/
https://patchwork.kernel.org/patch/1461051/
- Patch to address OF DMA helpers naming issues:
https://patchwork.kernel.org/patch/1477921/
- EDMA DMA Engine wrapper driver in linux-next c2dde5f8f2095d7c623ff3565c1462e190272273
- EDMA DMA Engine wrapper driver bug fix:
https://patchwork.kernel.org/patch/1474411/
- A huge number of patches in linux-next for AM33xx boot (too numerous to list)

The approach taken is similar to how OMAP DMA is being converted to DMA Engine support. With the functional EDMA private API already existing in mach-davinci/dma.c, we first move that to an ARM common area so it can be shared. Adding DT and runtime PM support to the private EDMA API implementation allows it to run on AM33xx. AM33xx *only* boots using DT so we leverage Jon's generic DT DMA helpers to register EDMA DMAC with the of_dma framework and then add support for calling the dma_request_slave_channel() API to both the mmc and spi drivers.

What works? Well, with this series we now have MMC and SPI support on AM33xx. The only caveat for MMC is that the mmc3 controller has its events on the crossbar and is not usable right now.

This is tested on BeagleBone with a SPI framebuffer driver and SD card.

After this series, the plan is to convert the last in-tree user of the private EDMA API (davinci-pcm/mcasp) and then eliminate the private EDMA API by folding its functionality into drivers/dma/edma.c.

Quoted 8 lines
Quoted 4 lines

TODO:
add AM33xx crossbar support to the private EDMA API (any EDMA events on the crossbar are not supported)

Can you please mention the base repo you have taken as starting point. (repo + extra patches ...).

It's mainline 3.6-rc6 and you can see the complete set of patches at https://github.com/ohporter/linux/tree/edma-dmaengine-am33xx-rfc-v1
after commit 5698bd757d55b1bb87edd1a9744ab09c142abfc2

Quoted 2 lines

This will help us to test the code.

Quoted 7 lines
Quoted 3 lines

This is because I looked at the patch 12/13 and I see that mmc device-node is modified. But in mainline I don?t see device node for mmc (yet).

Oops. You'll need e62a3333ae450bcdefbe22229d7bc277ae0ef645 and fe97304557d2c6f7d0aaf1ea028ea48ffca366a9 which I forgot to include in this series. I'll have them in for v2.

Yesterday I tested edma patches on latest linux-next/master + merge of linux-omap/for_3.7/dts_part2. Below are my observations

1. baseline = linux-next/master + merge of linux-omap/for_3.7/dts_part2
2. on top of above branch, I applied patches [1-9]/13 of your edma patches
3. few patches required trivial changes before applying
4. Applied dma of patches as you mentioned
5. add custom patch (ARM: CUSTOM: Build a uImage with dtb already appended)
From https://github.com/hvaibhav/am335x-linux/commit/

Quoted 1 line
        7e72f5ed4b702c9373d19f7626f07ae31a381d53#arch/arm/Makefile

Alternatively you can run a current u-boot master build for am335x and the appended dtb is no longer required.

Quoted 40 lines

6. Modified 9/13 patch to apply properly on latest am33xx.dtsi.

	a. Edma portion as it is
	b. mmc portion as below
		mmc1: mmc at 48060000 {
			compatible = "ti,omap3-hsmmc";
			ti,hwmods = "mmc1";
			ti,dual-volt;
			ti,needs-special-reset;
			bus-width = <4>;
			vmmc-supply = <&vmmc_reg>;
			dmas = <&edma 24
				&edma 25>;
			dma-names = "tx", "rx";
		};
	c. added mmc pinmux as-well

7. make CROSS_COMPILE=arm-arago-linux-gnueabi- ARCH=arm distclean make CROSS_COMPILE=arm-arago-linux-gnueabi- ARCH=arm omap2plus_defconfig

8. enabled TI_EDMA from menuconfig (since it was not enabled for omap2plus_defconfig

9. make CROSS_COMPILE=arm-arago-linux-gnueabi- ARCH=arm uImage make CROSS_COMPILE=arm-arago-linux-gnueabi- ARCH=arm uImage-dtb.am335x-evm

With above changes, edma probe was failing at request_mem_region() Inside linux-next/arch/arm/common/edma.c --> edma_probe()

I had to modify edma_probe as below

arch/arm/common/edma.c +0 -0
index f337f81..efe2673 100644
@@ -1589,11 +1589,11 @@ static int __init edma_probe(struct platform_device *pdev)
        for (j = 0; j < EDMA_MAX_CC; j++) {
                if (node) {

arch/arm/common/edma.c static int __init edma_probe(struct platform_device *pdev) · line 1598

Quoted 10 lines
arch/arm/common/edma.c +2 -2
                        int err;
-                       err = of_address_to_resource(node, 0, &res[j]);
+                       err = of_address_to_resource(node, j, &res[j]);
                        if (err) {
                                dev_err(dev,
                                        "unable to find 'reg' property\n");
-                               return -EIO;
+                               //return -EIO;
                        }
                        r[j] = &res[j];

Hrm, looks like a dts issue if it can't find the reg resource on your integration of this. In any case, I'll look at it in v2.

Quoted 2 lines

With this I was able to boot on am335x-evm and do a successful MMC copy-md5sum-compare test.

Great! Thanks for testing this.

Quoted 1 line

I believe you are looking into above issue in your v2 version.

Yes.

-Matt