Add DMA engine driver for Freescale MPC85xx processors.
Subsystems (2)
PATCH 5/5 Add DMA engine driver for Freescale MPC85xx processors.
The driver implements DMA engine API for Freescale MPC85xx DMA controller, which could be used for MEM<-->MEM, IO_ADDR<-->MEM and IO_ADDR<-->IO_ADDR data transfer.
The driver supports the Basic mode of Freescale MPC85xx DMA controller. The MPC85xx processors supported include MPC8540/60, MPC8555, MPC8548, MPC8641 and so on.
The support for MPC83xx(MPC8349, MPC8360) is experimental.
--- drivers/dma/Kconfig | 8 + drivers/dma/Makefile | 1 + drivers/dma/fsldma.c | 995 ++++++++++++++++++++++++++++++++++++++++++++++++++ drivers/dma/fsldma.h | 188 ++++++++++ 4 files changed, 1192 insertions(+), 0 deletions(-) create mode 100644 drivers/dma/fsldma.c create mode 100644 drivers/dma/fsldma.h
drivers/dma/Kconfig +8 -0
@@ -40,4 +40,12 @@ config INTEL_IOP_ADMA ---help--- Enable support for the Intel(R) IOP Series RAID engines. +config FSL_DMA + bool "Freescale MPC85xx/MPC83xx DMA support" + depends on DMA_ENGINE && PPC + ---help--- + Enable support for the Freescale DMA engine. Now, it support + MPC8560/40, MPC8555, MPC8548 and MPC8641 processors. + The MPC8349, MPC8360 support is experimental. + endmenu
drivers/dma/Makefile +1 -0
@@ -2,3 +2,4 @@ obj-$(CONFIG_DMA_ENGINE) += dmaengine.o obj-$(CONFIG_NET_DMA) += iovlock.o obj-$(CONFIG_INTEL_IOATDMA) += ioatdma.o obj-$(CONFIG_INTEL_IOP_ADMA) += iop-adma.o +obj-$(CONFIG_FSL_DMA) += fsldma.o
drivers/dma/fsldma.c new file +995 -0
995 lines not on this page · raw message
drivers/dma/fsldma.h new file +188 -0
188 lines not on this page · raw message
Signature · 1 line
1.5.2
drivers/dma/fsldma.c
Quoted 14 lines · On Fri, 7 Sep 2007 18:54:18 +0800 Zhang Wei wrote:
Signed-off-by Zhang Wei <[email protected]>Signed-off-by Ebony Zhu <[email protected]>--- drivers/dma/Kconfig | 8 + drivers/dma/Makefile | 1 + drivers/dma/fsldma.c | 995 ++++++++++++++++++++++++++++++++++++++++++++++++++ drivers/dma/fsldma.h | 188 ++++++++++ 4 files changed, 1192 insertions(+), 0 deletions(-) create mode 100644 drivers/dma/fsldma.c create mode 100644 drivers/dma/fsldma.hdrivers/dma/fsldma.c new file +0
-0@@ -0,0 +1,995 @@
Thanks for using kernel-doc notation. However, ...
drivers/dma/fsldma.c line 248
Quoted 2 lines
drivers/dma/fsldma.c new file +2
-0+/** +* fsl_dma_alloc_descriptor - Allocate descriptor from channel's DMA pool.
Function parameters need to be listed & described here. See Documentation/kernel-doc-nano-HOWTO.txt or other source files for examples.
(Applies to all documented function interfaces here.)
Quoted 7 lines
drivers/dma/fsldma.c new file +7
-0+* +* Return - The descriptor allocated. NULL for failed. +*/ +static struct fsl_desc_sw *fsl_dma_alloc_descriptor ( +struct fsl_dma_chan *fsl_chan, +gfp_t flags) +{
...
drivers/dma/fsldma.c line 472
Quoted 5 lines
drivers/dma/fsldma.c new file +4
-0+} +/** +* fsl_chan_xfer_ld_queue -- Transfer the link descriptors in channel +* ld_queue.
The function's "short description" (unfortunately) must be on only one line. E.g.:
* fsl_chan_xfer_ld_queue - Transfer link descriptors in channel ld_queue.
Quoted 3 lines
+ */
drivers/dma/fsldma.c new file +2
-0+static void fsl_chan_xfer_ld_queue (struct fsl_dma_chan *fsl_chan) +{
...
drivers/dma/fsldma.h line 4
Quoted 12 lines
drivers/dma/fsldma.c new file +1
-0+}drivers/dma/fsldma.h new file +4
-0@@ -0,0 +1,188 @@ +struct fsl_dma_chan_regs { +__mix32 mr;/* 0x00 - Mode Register */ +__mix32 sr;/* 0x04 - Status Register */ +__mix64 cdar;/* 0x08 - Cureent descriptor address register */
Current
drivers/dma/fsldma.h line 115
Quoted 5 lines
drivers/dma/fsldma.h new file +5
-0+__mix64 sar;/* 0x10 - Source Address Register */ +__mix64 dar;/* 0x18 - Destination Address Register */ +__mix32 bcr;/* 0x20 - Byte Count Register */ +__mix64 ndar;/* 0x24 - Next Descriptor Address Register */ +};
---
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***
Quoted 44 lines
From: Zhang Wei [mailto:[email protected]]
Sent: Friday, September 07, 2007 3:54 AM
To: [email protected]; Nelson, Shannon
Cc: [email protected]; [email protected]; [email protected]; Zhang Wei; Ebony Zhu
Subject: [PATCH 5/5] Add DMA engine driver for Freescale MPC85xx processors.The driver implements DMA engine API for Freescale MPC85xx DMA controller, which could be used for MEM<-->MEM, IO_ADDR<-->MEM and IO_ADDR<-->IO_ADDR data transfer.
The driver supports the Basic mode of Freescale MPC85xx DMA controller. The MPC85xx processors supported include MPC8540/60, MPC8555, MPC8548, MPC8641 and so on.
The support forMPC83xx(MPC8349, MPC8360)is experimental.Signed-off-by Zhang Wei <[email protected]>Signed-off-by Ebony Zhu <[email protected]>---
drivers/dma/Kconfig | 8 + drivers/dma/Makefile | 1 + drivers/dma/fsldma.c | 995 ++++++++++++++++++++++++++++++++++++++++++++++++++ drivers/dma/fsldma.h | 188 ++++++++++ 4 files changed, 1192 insertions(+), 0 deletions(-)create mode 100644
drivers/dma/fsldma.c
create mode 100644drivers/dma/fsldma.hdrivers/dma/Kconfig +8
-0@@ -40,4 +40,12 @@ config INTEL_IOP_ADMA ---help--- Enable support for the Intel(R) IOP Series RAID engines. +config FSL_DMA + bool "Freescale MPC85xx/MPC83xx DMA support" + depends on DMA_ENGINE && PPC + ---help--- + Enable support for the Freescale DMA engine. Now, it support + MPC8560/40, MPC8555, MPC8548 and MPC8641 processors. + The MPC8349, MPC8360 support is experimental. +
Quoted 1 line
endmenu
If this is experimental, perhaps you should mark the depends line as such
depends on on DMA_ENGINE && PPC && EXPERIMENTAL
[...]
Quoted 50 lines
drivers/dma/Kconfig +21
-0+static int fsl_dma_self_test(struct fsl_dma_chan *fsl_chan) +{ + struct dma_chan *chan; + int err = 0; + dma_addr_t addr; + dma_cookie_t cookie; + u8 *src, *dest; + int i; + size_t test_size; + struct dma_async_tx_descriptor *tx1, *tx2, *tx3; + struct fsl_dma_device *fdev; + + BUG_ON(!fsl_chan); + + fdev = fsl_chan->device; + test_size = 4096; + + src = kmalloc(test_size * 2, GFP_KERNEL); + if (!src) { + dev_err(fdev->dev, + "selftest: Can not alloc memoryfor test!\n");
drivers/dma/Kconfig +14
-0+ err = -ENOMEM; + goto out; + } + + dest = src + test_size; + + for (i = 0; i < test_size; i++) + src[i] = (u8) i; + + chan = &fsl_chan->common; + + if (fsl_dma_alloc_chan_resources(chan) < 1) { + dev_err(fdev->dev, + "selftest: Can not allocresources for DMA\n");
drivers/dma/Kconfig +12
-0+ err = -ENODEV; + goto out; + } + + /* TX 1 */ + tx1 = fsl_dma_prep_memcpy(chan, test_size / 2, 0); + async_tx_ack(tx1); + addr = dma_map_single(chan->device->dev, src, test_size / 2, + DMA_TO_DEVICE); + fsl_dma_set_src(addr, tx1, 0); + addr = dma_map_single(chan->device->dev, dest, test_size / 2, +
DMA_FROM_DEVICE);
drivers/dma/Kconfig
Quoted 7 lines
drivers/dma/Kconfig +7
-0+ fsl_dma_set_dest(addr, tx1, 0); + + cookie = fsl_dma_tx_submit(tx1); + fsl_dma_memcpy_issue_pending(chan); + + while (fsl_dma_is_complete(chan, cookie, NULL, NULL) + != DMA_SUCCESS);
Is this guaranteed to finish? If there's something wrong and the DMA never completes, you've now hung this thread. This is why the ioat_dma engine does an msleep() and then checks once for completion. You might think about this...
Quoted 33 lines
drivers/dma/Kconfig +7
-0+ + /* Test free and re-alloc channel resources */ + fsl_dma_free_chan_resources(chan); + + if (fsl_dma_alloc_chan_resources(chan) < 1) { + dev_err(fdev->dev, + "selftest: Can not allocresources for DMA\n");
drivers/dma/Kconfig +20
-0+ err = -ENODEV; + goto out; + } + + /* Continue to test + * TX 2 + */ + tx2 = fsl_dma_prep_memcpy(chan, test_size / 4, 0); + async_tx_ack(tx2); + addr = dma_map_single(chan->device->dev, src + test_size / 2, + test_size / 4, DMA_TO_DEVICE); + fsl_dma_set_src(addr, tx2, 0); + addr = dma_map_single(chan->device->dev, dest + test_size / 2, + test_size / 4, DMA_FROM_DEVICE); + fsl_dma_set_dest(addr, tx2, 0); + + /* TX 3 */ + tx3 = fsl_dma_prep_memcpy(chan, test_size / 4, 0); + async_tx_ack(tx3); + addr = dma_map_single(chan->device->dev, src +
test_size* 3 / 4,drivers/dma/Kconfig +3
-0+ test_size / 4, DMA_TO_DEVICE); + fsl_dma_set_src(addr, tx3, 0); + addr = dma_map_single(chan->device->dev, dest +
test_size* 3 / 4,
drivers/dma/Kconfig
Quoted 10 lines
drivers/dma/Kconfig +10
-0+ test_size / 4, DMA_FROM_DEVICE); + fsl_dma_set_dest(addr, tx3, 0); + + /* Test exchanging the prepared tx sort */ + cookie = fsl_dma_tx_submit(tx3); + cookie = fsl_dma_tx_submit(tx2); + + fsl_dma_memcpy_issue_pending(chan); + while (fsl_dma_is_complete(chan, cookie, NULL, NULL) + != DMA_SUCCESS);
Again, is it possible to hang your thread here?
[...]
sln
--
======================================================================
Mr. Shannon Nelson LAN Access Division, Intel Corp.
[email protected] I don't speak for Intel
(503) 712-7659 Parents can't afford to be squeamish.
Quoted 11 lines · Zhang Wei
The driver implements DMA engine API for Freescale MPC85xx DMA controller, which could be used for MEM<-->MEM, IO_ADDR<-->MEM and IO_ADDR<-->IO_ADDR data transfer.
The driver supports the Basic mode of Freescale MPC85xx DMA controller. The MPC85xx processors supported include MPC8540/60, MPC8555, MPC8548, MPC8641 and so on.
The support forMPC83xx(MPC8349, MPC8360)is experimental.Signed-off-by Zhang Wei <[email protected]>Signed-off-by Ebony Zhu <[email protected]>---
Greetings,
Please copy me on any updates to this driver, drivers/dma, or crypto/async_tx.
Below are a few review comments...
Regards,
Dan
Quoted 16 lines
drivers/dma/fsldma.c new file +16
-0+/** +* fsl_dma_alloc_descriptor - Allocate descriptor from channel's DMA pool. +* +* Return - The descriptor allocated. NULL for failed. +*/ +static struct fsl_desc_sw *fsl_dma_alloc_descriptor ( +struct fsl_dma_chan *fsl_chan, +gfp_t flags) +{ +dma_addr_t pdesc; +struct fsl_desc_sw *desc_sw; + + desc_sw =dma_pool_alloc (fsl_chan->desc_pool, flags, &pdesc); +if (desc_sw) { +memset (desc_sw,0 ,sizeof (struct fsl_desc_sw )); + dma_async_tx_descriptor_init(&desc_sw->async_tx,
drivers/dma/fsldma.c line 272
Quoted 10 lines
drivers/dma/fsldma.c new file +10
-0+ &fsl_chan->common); + desc_sw->async_tx.tx_set_src = fsl_dma_set_src; + desc_sw->async_tx.tx_set_dest = fsl_dma_set_dest; + desc_sw->async_tx.tx_submit = fsl_dma_tx_submit; +INIT_LIST_HEAD (&desc_sw->async_tx.tx_list); + desc_sw->async_tx.phys = pdesc; + } + +return desc_sw; +}
I suggest pre-allocating the descriptors:
1/ It alleviates the need to initialize these async_tx fields which never change 2/ The GFP_ATOMIC allocation can be removed.
iop-adma gets by with one PAGE_SIZE buffer (128 descriptors).
[..]
Quoted 34 lines
drivers/dma/fsldma.c new file +34
-0+static irqreturn_t fsl_dma_chan_do_interrupt (int irq,void *data) +{ +struct fsl_dma_chan *fsl_chan = (struct fsl_dma_chan *)data; +dma_addr_t stat; + + stat =get_sr (fsl_chan); +dev_dbg (fsl_chan->device->dev,"event: channel %d, stat = 0x%x\n" , + fsl_chan->id, stat); +set_sr (fsl_chan, stat);/* Clear the event register */ + + stat &= ~(FSL_DMA_SR_CB |FSL_DMA_SR_CH ); +if (!stat) +return IRQ_NONE ; + +/* If the link descriptor segment transfer finishes, +* we will recycle the used descriptor. +*/ +if (stat &FSL_DMA_SR_EOSI ) { +dev_dbg (fsl_chan->device->dev,"event: End-of-segments INT\n" ); +dev_dbg (fsl_chan->device->dev,"event: clndar 0x%016llx, " +"nlndar 0x%016llx\n" , (u64 )get_cdar (fsl_chan), + (u64 )get_ndar (fsl_chan)); + stat &= ~FSL_DMA_SR_EOSI ; +fsl_chan_ld_cleanup (fsl_chan,1 ); + } + +/* If it current transfer is the end-of-transfer, +* we should clear the Channel Start bit for +* prepare next transfer. +*/ +if (stat & (FSL_DMA_SR_EOLNI |FSL_DMA_SR_EOCDI )) { +dev_dbg (fsl_chan->device->dev,"event: End-of-link INT\n" ); + stat &= ~FSL_DMA_SR_EOLNI ; +fsl_chan_xfer_ld_queue (fsl_chan);
drivers/dma/fsldma.c line 625
Quoted 10 lines
drivers/dma/fsldma.c new file +10
-0+ } + +if (stat) +dev_dbg (fsl_chan->device->dev,"event: unhandled sr 0x%02x\n" , + stat); + +dev_dbg (fsl_chan->device->dev,"event: Exit\n" ); +tasklet_hi_schedule (&dma_tasklet); +return IRQ_HANDLED ; +}
This driver implements locking and callbacks inconsistently with how it is done in ioatdma and iop-adma. The big changes are that all locks have been upgraded from 'spin_lock_bh' to 'spin_lock_irqsave', and async_tx callbacks can happen in irq context. I would like to keep everything in bottom-half context to lessen the restrictions on what async_tx clients can perform in their callback routines. What are the implications of moving 'fsl_chan_ld_cleanup' to the tasklet and changing the 'tasklet_hi_schedule' to 'tasklet_schedule'?
[..]
Quoted 8 lines
drivers/dma/fsldma.c new file +8
-0+static struct dma_chan *of_find_dma_chan_by_phandle (phandle phandle) +{ +struct device_node *np; +struct dma_chan *chan; +struct fsl_dma_device *fdev; + + np =of_find_node_by_phandle (phandle); +if (!np || !of_device_is_compatible (np->parent,"fsl,dma" ))
drivers/dma/fsldma.c line 804
Quoted 10 lines
drivers/dma/fsldma.c new file +10
-0+return NULL ; + + fdev =dev_get_drvdata (&of_find_device_by_node (np->parent)->dev); + +list_for_each_entry (chan, &fdev->common.channels, device_node) +if (to_of_device (to_fsl_chan (chan)->chan_dev)->node == np) +return chan; +return NULL ; +} +EXPORT_SYMBOL (of_find_dma_chan_by_phandle);
This routine implies that there is a piece of code somewhere that wants to select which channels it can use. A similar effect can be achieved by registering a dma_client with the dmaengine interface ('dma_async_client_register'). Then when the client code makes a call to 'dma_async_client_chan_request' it receives a 'dma_event_callback' for each channel in the system. It will also be asynchronously notified of channels entering and leaving the system. The goal is to share a common infrastructure for channel management.
Quoted 30 lines
drivers/dma/fsldma.c new file +30
-0+ +static int __devinit of_fsl_dma_probe (struct of_device *dev, +const struct of_device_id *match) +{ +int err; +unsigned int irq; +struct fsl_dma_device *fdev; + + fdev =kzalloc (sizeof (struct fsl_dma_device ),GFP_KERNEL ); +if (!fdev) { +dev_err (&dev->dev,"No enough memory for 'priv'\n" ); + err = -ENOMEM ; + goto err; + } + fdev->dev = &dev->dev; +INIT_LIST_HEAD (&fdev->common.channels); + +/* get DMA controller register base */ + err =of_address_to_resource (dev->node,0 , &fdev->reg); +if (err) { +dev_err (&dev->dev,"Can't get %s property 'reg'\n" , + dev->node->full_name); + goto err; + } + +dev_info (&dev->dev,"Probe the Freescale DMA driver for %s " +"controller at 0x%08x...\n" , + match->compatible, fdev->reg.start); + fdev->reg_base =ioremap (fdev->reg.start, fdev->reg.end + - fdev->reg.start +1 );
drivers/dma/fsldma.c line 844
Quoted 10 lines
drivers/dma/fsldma.c new file +10
-0+ +dma_cap_set (DMA_MEMCPY , fdev->common.cap_mask); + fdev->common.device_alloc_chan_resources = fsl_dma_alloc_chan_resources; + fdev->common.device_free_chan_resources = fsl_dma_free_chan_resources; + fdev->common.device_prep_dma_memcpy = fsl_dma_prep_memcpy; + fdev->common.device_is_tx_complete = fsl_dma_is_complete; + fdev->common.device_issue_pending = fsl_dma_memcpy_issue_pending; + fdev->common.device_dependency_added = fsl_dma_dependency_added; + fdev->common.dev = &dev->dev; +
If this driver adds:
dma_cap_set(DMA_INTERRUPT, fdev->common.cap_mask); fdev->common.device_prep_dma_interrupt = fsl_dma_prep_interrupt;
It will be able to take advantage of interrupt triggered callbacks in async_tx. Without these changes async_tx will poll for the completion of each transaction.
[..]
Quoted 8 lines · Dan Williams
This routine implies that there is a piece of code somewhere that wants to select which channels it can use. A similar effect can be achieved by registering a
dma_clientwith the dmaengine interface ('dma_async_client_register'). Then when the client code makes a call to 'dma_async_client_chan_request' it receives a 'dma_event_callback' for each channel in the system. It will also be asynchronously notified of channels entering and leaving the system. The goal is to share a common infrastructure for channel management.
Are you familiar with the "flat device tree" used for PowerPC systems? The "piece of code somewhere" is the device tree subsystem that parses the device tree, which is compiled from the .dts files in arch/powerpc/boot/dts.
The FDT is how PowerPC systems specify hardware configuration. In the case of 85xx, the FDT contains entries for each DMA device (typically 2), and the entries contain sub-entries for each DMA channel as well as the address of the register sets for each channel.
Signature · 2 lines
Timur Tabi Linux Kernel Developer @ Freescale
Quoted 11 lines · Timur Tabi
Quoted 8 lines · Dan Williams
This routine implies that there is a piece of code somewhere that wants to select which channels it can use. A similar effect can be achieved by registering a
dma_clientwith the dmaengine interface ('dma_async_client_register'). Then when the client code makes a call to 'dma_async_client_chan_request' it receives a 'dma_event_callback' for each channel in the system. It will also be asynchronously notified of channels entering and leaving the system. The goal is to share a common infrastructure for channel management.
Quoted 9 lines
Are you familiar with the "flat device tree" used for PowerPC systems? The "piece of code somewhere" is the device tree subsystem that parses the device tree, which is compiled from the .dts files in
arch/powerpc/boot/dts.The FDT is how PowerPC systems specify hardware configuration. In the case of 85xx, the FDT contains entries for each DMA device (typically 2), and the entries contain sub-entries for each DMA channel as well as the address of the register sets for each channel.
Ahh, ok then this code is replacing what would normally be handled by the PCI bus enumeration code, or the platform device registrations for iop-adma in arch/arm/mach-iop13xx. Sorry for the noise with this comment.
Quoted 4 lines
--
Timur Tabi
Linux Kernel Developer @ Freescale
-
Thanks,
Dan
Hi,=20
Quoted 8 lines
---
/dev/nullReview
Quoted 2 lines
+++
b/drivers/dma/fsldma.c(quoted diff) +0
-0@@ -0,0 +1,995 @@=20
Thanks for using kernel-doc notation. However, ... =20Review line 2
Quoted 2 lines
(quoted diff) +2
-0+/** + * fsl_dma_alloc_descriptor - Allocate descriptor from=20
Quoted 7 lines
channel's DMA pool.
=20
Function parameters need to be listed & described here. SeeDocumentation/kernel-doc-nano-HOWTO.txtor other source files for examples.
=20
(Applies to all documented function interfaces here.)
All right, I'll add full descriptions here. :P
Quoted 14 lines
=20
Quoted 7 lines
drivers/dma/fsldma.c new file +7
-0+* +* Return - The descriptor allocated. NULL for failed. +*/ +static struct fsl_desc_sw *fsl_dma_alloc_descriptor ( +struct fsl_dma_chan *fsl_chan, +gfp_t flags) +{...
Quoted 1 line
+}
=20
Quoted 2 lines
+/**
+ *fsl_chan_xfer_ld_queue-- Transfer the link descriptors=20in channel
Quoted 8 lines
Quoted 1 line
+ *
ld_queue.=20
The function's "short description" (unfortunately) must be on only one line. E.g.:
=20
*fsl_chan_xfer_ld_queue- Transfer link descriptors in=20
channelld_queue.
=20
How about it's length greater than 80?
Quoted 6 lines
Quoted 3 lines
+ */
(quoted diff) +2
-0+static void fsl_chan_xfer_ld_queue(struct fsl_dma_chan *fsl_chan) +{...
Quoted 1 line
+}
=20
Quoted 14 lines
drivers/dma/fsldma.h line 4
Quoted 10 lines
drivers/dma/fsldma.h new file +4
-0@@ -0,0 +1,188 @@ +struct fsl_dma_chan_regs { +__mix32 mr;/* 0x00 - Mode Register */ +__mix32 sr;/* 0x04 - Status Register */ +__mix64 cdar;/* 0x08 - Cureent descriptor=20 address register */
=20
Current
=20
I'll fix it.
Thanks!
- zw
Quoted 4 lines
=20
If this is experimental, perhaps you should mark the depends line as suchdepends on on DMA_ENGINE && PPC && EXPERIMENTAL
I'll add EXPERIMENTAL for MPC83xx only.
Quoted 11 lines
=20
[...]
=20drivers/dma/fsldma.c
Quoted 4 lines
drivers/dma/fsldma.c new file +4
-0+ +fsl_dma_memcpy_issue_pending (chan); +while (fsl_dma_is_complete (chan, cookie,NULL ,NULL ) + !=3D DMA_SUCCESS);=20
Again, is it possible to hang your thread here?
=20
[...]
I'll add msleep here.
Thanks!
- zw
Hi, Dan,
Does I have followed your new API? :-)
Quoted 5 lines
Quoted 1 line
---
Greetings,
=20
Please copy me on any updates to this driver,drivers/dma, or=20crypto/async_tx.
Ok.
Quoted 31 lines
=20
Below are a few review comments...
=20
Regards,
Dan
=20Quoted 2 lines
+/**
+ *fsl_dma_alloc_descriptor- Allocate descriptor from=20channel's DMA pool.
Review
Quoted 5 lines
+ *
+ * Return - The descriptor allocated. NULL for failed.
+ */(quoted diff) +2
-0+static struct fsl_desc_sw *fsl_dma_alloc_descriptor( + struct fsl_dma_chan=20
*fsl_chan,drivers/dma/fsldma.c
Quoted 6 lines
drivers/dma/fsldma.c new file +6
-0+ gfp_t flags) +{ +dma_addr_t pdesc; +struct fsl_desc_sw *desc_sw; + + desc_sw =3D dma_pool_alloc(fsl_chan->desc_pool,=20flags, &pdesc);
Quoted 9 lines
drivers/dma/fsldma.c new file +9
-0+if (desc_sw) { +memset (desc_sw,0 ,sizeof (struct fsl_desc_sw )); +dma_async_tx_descriptor_init (&desc_sw->async_tx, + &fsl_chan->common); + desc_sw->async_tx.tx_set_src =3D fsl_dma_set_src; + desc_sw->async_tx.tx_set_dest =3D fsl_dma_set_dest; + desc_sw->async_tx.tx_submit =3D fsl_dma_tx_submit; +INIT_LIST_HEAD (&desc_sw->async_tx.tx_list); + desc_sw->async_tx.phys =3D pdesc;
Quoted 8 lines
drivers/dma/fsldma.c line 272
Quoted 4 lines
drivers/dma/fsldma.c new file +4
-0+ } + +return desc_sw; +}=20
I suggest pre-allocating the descriptors:
1/ It alleviates the need to initialize theseasync_txfields=20 which never change
The dma pool has already stored the descriptors in it's list,
Quoted 2 lines
2/ The
GFP_ATOMICallocation can be removed.
=20
Ok.
Quoted 6 lines
iop-adma gets by with one
PAGE_SIZEbuffer (128 descriptors). =20
[..]drivers/dma/fsldma.c
Quoted 3 lines
drivers/dma/fsldma.c new file +3
-0+static irqreturn_t fsl_dma_chan_do_interrupt(int irq, void *data) +{ + struct fsl_dma_chan *fsl_chan =3D (struct fsl_dma_chan =
*)data;
Quoted 42 lines
drivers/dma/fsldma.c
Quoted 4 lines
drivers/dma/fsldma.c new file +4
-0+dma_addr_t stat; + + stat =3D get_sr(fsl_chan); + dev_dbg(fsl_chan->device->dev, "event: channel %d,=20stat =3D 0x%x\n",
Review
Quoted 2 lines
(quoted diff) +2
-0+ fsl_chan->id, stat); + set_sr(fsl_chan, stat); /* Clear the event=20register */
drivers/dma/fsldma.c
Quoted 10 lines
drivers/dma/fsldma.c new file +10
-0+ + stat &=3D ~(FSL_DMA_SR_CB | FSL_DMA_SR_CH); +if (!stat) +return IRQ_NONE ; + +/* If the link descriptor segment transfer finishes, +* we will recycle the used descriptor. +*/ +if (stat &FSL_DMA_SR_EOSI ) { + dev_dbg(fsl_chan->device->dev, "event:=20End-of-segments INT\n");
Quoted 1 line
+ dev_dbg(fsl_chan->device->dev, "event:=20
clndar 0x%016llx, "
Quoted 1 line
+ "nlndar 0x%016llx\n",=20
(u64)get_cdar(fsl_chan),
drivers/dma/fsldma.c
Quoted 11 lines
drivers/dma/fsldma.c new file +11
-0+ (u64)get_ndar(fsl_chan)); + stat &=3D ~FSL_DMA_SR_EOSI; +fsl_chan_ld_cleanup (fsl_chan,1 ); + } + +/* If it current transfer is the end-of-transfer, +* we should clear the Channel Start bit for +* prepare next transfer. +*/ +if (stat & (FSL_DMA_SR_EOLNI |FSL_DMA_SR_EOCDI )) { + dev_dbg(fsl_chan->device->dev, "event:=20End-of-link INT\n");
drivers/dma/fsldma.c
Quoted 6 lines
drivers/dma/fsldma.c new file +6
-0+ stat &=3D ~FSL_DMA_SR_EOLNI; +fsl_chan_xfer_ld_queue (fsl_chan); + } + +if (stat) + dev_dbg(fsl_chan->device->dev, "event:=20unhandled sr 0x%02x\n",
Quoted 15 lines
drivers/dma/fsldma.c line 625
Quoted 6 lines
drivers/dma/fsldma.c new file +6
-0+ stat); + +dev_dbg (fsl_chan->device->dev,"event: Exit\n" ); +tasklet_hi_schedule (&dma_tasklet); +return IRQ_HANDLED ; +}=20
This driver implements locking and callbacks inconsistently with how it is done in ioatdma and iop-adma. The big changes are that all locks have been upgraded from 'spin_lock_bh' to 'spin_lock_irqsave', andasync_txcallbacks can happen in irq context. I would like to keep everything in bottom-half context to lessen the restrictions on whatasync_txclients can perform in their callback routines. What are the implications of moving 'fsl_chan_ld_cleanup' to the tasklet and changing the 'tasklet_hi_schedule' to 'tasklet_schedule'?
A good suggestion :), I need some investigation here.
Quoted 20 lines
=20
[..]Quoted 1 line
+static struct dma_chan=20
*of_find_dma_chan_by_phandle(phandle phandle)
drivers/dma/fsldma.c
Quoted 10 lines
drivers/dma/fsldma.c new file +10
-0+{ +struct device_node *np; +struct dma_chan *chan; +struct fsl_dma_device *fdev; + + np =3D of_find_node_by_phandle(phandle); +if (!np || !of_device_is_compatible (np->parent,"fsl,dma" )) +return NULL ; + + fdev =3D=20dev_get_drvdata(&of_find_device_by_node(np->parent)->dev);
Review
Quoted 2 lines
(quoted diff) +2
-0+ + list_for_each_entry(chan, &fdev->common.channels,=20
device_node)Quoted 1 line
+ if=20
(to_of_device(to_fsl_chan(chan)->chan_dev)->node =3D=3D np)
Quoted 14 lines
drivers/dma/fsldma.c line 804
Quoted 4 lines
drivers/dma/fsldma.c new file +4
-0+return chan; +return NULL ; +} +EXPORT_SYMBOL (of_find_dma_chan_by_phandle);=20
This routine implies that there is a piece of code somewhere that wants to select which channels it can use. A similar effect can be achieved by registering adma_clientwith the dmaengine interface ('dma_async_client_register'). Then when the client code makes a call to 'dma_async_client_chan_request' it receives a 'dma_event_callback' for each channel in the system. It will also be asynchronously notified of channels entering and leaving the system. The goal is to share a common infrastructure for channel management.
=20
It's speacial codes for our processors. Some device need the speacial = DMA channel, such as must be DMA channel 0. So I add these codes. Or, is = it possible to add a API for the special DMA channel getting?
Quoted 45 lines
Quoted 20 lines
drivers/dma/fsldma.c new file +20
-0+ +static int __devinit of_fsl_dma_probe (struct of_device *dev, +const struct of_device_id *match) +{ +int err; +unsigned int irq; +struct fsl_dma_device *fdev; + + fdev =3D kzalloc(sizeof(struct fsl_dma_device), GFP_KERNEL); +if (!fdev) { +dev_err (&dev->dev,"No enough memory for 'priv'\n" ); + err =3D -ENOMEM ; + goto err; + } + fdev->dev =3D &dev->dev; +INIT_LIST_HEAD (&fdev->common.channels); + +/* get DMA controller register base */ + err =3D of_address_to_resource(dev->node, 0, &fdev->reg); +if (err) {drivers/dma/fsldma.c
Quoted 10 lines
drivers/dma/fsldma.c new file +10
-0+dev_err (&dev->dev,"Can't get %s property 'reg'\n" , + dev->node->full_name); + goto err; + } + +dev_info (&dev->dev,"Probe the Freescale DMA driver for %s " +"controller at 0x%08x...\n" , + match->compatible, fdev->reg.start); + fdev->reg_base =3D ioremap(fdev->reg.start, fdev->reg.end + -=20
fdev->reg.start+ 1);drivers/dma/fsldma.c
Quoted 3 lines
drivers/dma/fsldma.c new file +3
-0+ +dma_cap_set (DMA_MEMCPY , fdev->common.cap_mask); + fdev->common.device_alloc_chan_resources =3D=20
fsl_dma_alloc_chan_resources;Quoted 1 line
+
fdev->common.device_free_chan_resources=3D=20
fsl_dma_free_chan_resources;Review
Quoted 3 lines
(quoted diff) +3
-0+ fdev->common.device_prep_dma_memcpy =3D fsl_dma_prep_memcpy; + fdev->common.device_is_tx_complete =3D fsl_dma_is_complete; + fdev->common.device_issue_pending =3D=20
fsl_dma_memcpy_issue_pending;Quoted 1 line
+
fdev->common.device_dependency_added=3D=20
fsl_dma_dependency_added;Review
Quoted 2 lines
(quoted diff) +2
-0+ fdev->common.dev =3D &dev->dev; +
Quoted 9 lines
If this driver adds:
=20dma_cap_set(DMA_INTERRUPT, fdev->common.cap_mask);fdev->common.device_prep_dma_interrupt=3Dfsl_dma_prep_interrupt; =20
It will be able to take advantage of interrupt triggered callbacks inasync_tx. Without these changesasync_txwill poll for the completion of each transaction.
=20
The new API have lacking documents :) I'll make some study here.
Thanks!
- zw
Quoted 10 lines · On Tue, Sep 11, 2007 at 06:10:53PM +0800, Zhang Wei-r63237 wrote:
Quoted 8 lines
drivers/dma/fsldma.c line 730
Quoted 4 lines
drivers/dma/fsldma.c new file +4
-0+ +fsl_dma_memcpy_issue_pending (chan); +while (fsl_dma_is_complete (chan, cookie,NULL ,NULL ) + !=DMA_SUCCESS );Again, is it possible to hang your thread here?
[...]
I'll add msleep here.
I think what was being sought was a timout, causing the test to return failure.
-Scott
Quoted 4 lines · Zhang Wei-r63237 wrote:
Quoted 4 lines
Quoted 2 lines
+/**
+ *fsl_chan_xfer_ld_queue-- Transfer the link descriptorsin channel
Quoted 1 line
+ *
ld_queue.
Quoted 8 lines
Quoted 6 lines
The function's "short description" (unfortunately) must be on only one line. E.g.:
*
fsl_chan_xfer_ld_queue- Transfer link descriptors in
channelld_queue.How about it's length greater than 80?
If it's close to 80+, you can just leave it like that. If it's much longer, you can use this format:
/**
* function_name - short description
* @parameters: prm description
*
* Longer
* function
* description.
*/
Thanks,
~Randy
Quoted 17 lines
From: Scott Wood [mailto:[email protected]]=20
Sent: Tuesday, September 11, 2007 7:20 AM
To: Zhang Wei-r63237
Cc: Nelson, Shannon; [email protected];=20 [email protected]; Williams, Dan J; [email protected]
Subject: Re: [PATCH 5/5] Add DMA engine driver for Freescale=20 MPC85xx processors.Quoted 8 lines · On Tue, Sep 11, 2007 at 06:10:53PM +0800, Zhang Wei-r63237 wrote:
Quoted 8 lines
drivers/dma/fsldma.c
Quoted 4 lines
drivers/dma/fsldma.c new file +4
-0+ +fsl_dma_memcpy_issue_pending (chan); +while (fsl_dma_is_complete (chan, cookie,NULL ,NULL ) + !=3D DMA_SUCCESS);=20
Again, is it possible to hang your thread here?
=20
[...]
Quoted 8 lines
Quoted 2 lines
=20
I'll add msleep here.I think what was being sought was a timout, causing the test to return failure.
-Scott
Either a timeout to stop the polling, or msleep() followed by a single call to fsl_dma_is_complete(). However, using the msleep() method is likely to be kinder to the rest of the kernel than polling for very long.
sln
RE: [PATCH 5/5] Add DMA engine driver for Freescale MPC85xxprocessors.
In reply to a message not in the archiveHi,=20
Quoted 8 lines
Review
Quoted 2 lines
(quoted diff) +2
-0+static void fsl_dma_set_src(dma_addr_t addr, + struct dma_async_tx_descriptor=20*tx, int index)
Quoted 1 line
+{
=20
What is index supposed to mean? It's not used, or documented=20 anywhere than
I can see.
I've also got more document here. Hi, Dan, could you give me some explanation about this API? :)
Quoted 13 lines
=20
drivers/dma/fsldma.c
Quoted 4 lines
drivers/dma/fsldma.c new file +4
-0+else { +/* Run the link descriptor callback function */ +if (desc->async_tx.callback) { + =09spin_unlock_irqrestore(&fsl_chan->desc_lock,
drivers/dma/fsldma.c
Quoted 3 lines
drivers/dma/fsldma.c new file +3
-0+ flags); + dev_dbg(fsl_chan->device->dev, + "link descriptor %p=20callback\n", desc);
Review
Quoted 2 lines
(quoted diff) +2
-0+ desc->async_tx.callback( + =09
desc->async_tx.callback_param);
Quoted 7 lines
Review
Quoted 1 line
(quoted diff) +1
-0+ =09
spin_lock_irqsave(&fsl_chan->desc_lock, flags);
=20
After dropping the lock, you can no longer assume that your=20 iterator is
still valid; you need to work off of the list head. =20
list_for_each_entry_safe() is used here. I think the safe should be ok. :P
Quoted 6 lines
Review
Quoted 5 lines
(quoted diff) +5
-0+ /* Find the first un-transfer desciptor */ + for (ld_node =3D fsl_chan->ld_queue.next; + (ld_node !=3D &fsl_chan->ld_queue) + && (DMA_SUCCESS =3D=3D dma_async_is_complete( + =09to_fsl_desc(ld_node)->async_tx.cookie,
Quoted 15 lines
drivers/dma/fsldma.c
Quoted 3 lines
drivers/dma/fsldma.c new file +3
-0+ fsl_chan->completed_cookie, + fsl_chan->common.cookie)); + ld_node =3D ld_node->next);=20
Callfsl_dma_is_completedirectly, don't waste time going through the virtual call.
=20
And you have a recursive lock usage here;fsl_dma_is_completecallsfsl_chan_ld_cleanup, which acquiresdesc_lock, but you=20 already have it.
=20
Couldn't you just callfsl_chan_ld_cleanup, and then check=20 what's at the
head of the list?
=20
I'll split interrupt and poll here.
Quoted 15 lines
drivers/dma/fsldma.c
Quoted 9 lines
drivers/dma/fsldma.c new file +9
-0+static irqreturn_t fsl_dma_do_interrupt (int irq,void *data) +{ + struct fsl_dma_device *fdev =3D (struct fsl_dma_device *)data; + struct fsl_dma_chan *fsl_chan =3D NULL; +u32 gsr; +int ch_nr; +struct dma_chan *int_chan; + + gsr =3D (fdev->feature & FSL_DMA_BIG_ENDIAN) ?=20
in_be32(fdev->reg_base)drivers/dma/fsldma.c
Quoted 4 lines
drivers/dma/fsldma.c new file +4
-0+ : in_le32(fdev->reg_base); + ch_nr =3D (32 -ffs (gsr)) /8 ; + + list_for_each_entry(int_chan, &fdev->common.channels,=20
device_node)
Quoted 4 lines
Review
Quoted 2 lines
(quoted diff) +2
-0+ if (to_fsl_chan(int_chan)->id =3D=3D ch_nr) + fsl_chan =3D to_fsl_chan(int_chan);=20
Why not use an array of channels?
The list is used in dma engine core file. And it's possible that there are not all channel listed in dts and array.
Quoted 22 lines
Review
Quoted 2 lines
(quoted diff) +2
-0+ + return fsl_chan ? fsl_dma_chan_do_interrupt(irq,=20
fsl_chan) :IRQ_NONE;drivers/dma/fsldma.c
Quoted 12 lines
drivers/dma/fsldma.c new file +12
-0+ +} + +static void dma_do_tasklet (unsigned long unused) +{ +struct fsl_desc_sw *desc, *_desc; +unsigned long flags; + +spin_lock_irqsave (&recy_ln_lock, flags); +list_for_each_entry_safe (desc, _desc, &recy_ln_chain, node) { +struct fsl_dma_chan *fsl_chan =3D + =09
to_fsl_chan(desc->async_tx.chan);drivers/dma/fsldma.c
Quoted 5 lines
drivers/dma/fsldma.c new file +5
-0+/* Run the link descriptor callback function */ +if (desc->async_tx.callback) { +spin_unlock_irqrestore (&recy_ln_lock, flags); + dev_dbg(fsl_chan->device->dev, + "dma_tasklet: link descriptor=20%p callback\n",
Quoted 11 lines
drivers/dma/fsldma.c line 667
Quoted 7 lines
drivers/dma/fsldma.c new file +7
-0+ desc); + desc->async_tx.callback ( + desc->async_tx.callback_param); +spin_lock_irqsave (&recy_ln_lock, flags); + } +/* Recycle it! */ +list_del (&desc->node);=20
You should remove it from the list before dropping the lock,=20 as otherwise
something else could come along and remove it again.
All right!
Quoted 9 lines
=20
Review
Quoted 2 lines
(quoted diff) +2
-0+ if (strcmp(match->compatible, "fsl,mpc8540-dma-channel") =3D=3D 0) + new_fsl_chan->feature =3D FSL_DMA_IP_86XX |=20
FSL_DMA_BIG_ENDIAN;
=20
Shouldn't it be 85XX, to be consistent?
=20Review
Quoted 1 line
(quoted diff) +1
-0+ else if (strcmp(match->compatible,=20"fsl,mpc8349-dma-channel") =3D=3D 0)
Quoted 7 lines
Review
Quoted 1 line
(quoted diff) +1
-0+ new_fsl_chan->feature =3D FSL_DMA_IP_83XX |=20
FSL_DMA_LITTLE_ENDIAN;
=20
You could have the features be part of the match struct, so=20 you don't have
to do extra strcmps.
=20
Can I use the data field of struct of_device_id?
Quoted 6 lines
=20
Review
Quoted 3 lines
(quoted diff) +3
-0+static struct of_device_id of_fsl_dma_ids[] =3D { + { .compatible =3D "fsl,dma", }, +};=20
Why do we need to bind to the parent node at all?
Yes, the MPC83xx should get interrupt source from DMA device register.
Quoted 15 lines
=20
Quoted 1 line
+/* There is no asm instructions for 64 bits reverse loads=20
and stores */
drivers/dma/fsldma.h line 170
Quoted 10 lines
drivers/dma/fsldma.h new file +10
-0+static u64 in_le64 (const u64 __iomem *addr) +{ +return le64_to_cpu (in_be64 (addr)); +} + +static void out_le64 (u64 __iomem *addr,u64 val) +{ +out_be64 (addr,cpu_to_le64 (val)); +} +#endif =20
You can use asm instructions for this, as such:
Aha, they are just copied from io.h.
Quoted 9 lines
=20
static u64in_le64(const u64 __iomem *addr){ return ((u64)in_le32((u32 *)addr + 1) << 32) |=20(
in_le32((u32 *)addr));
}
=20
=20
static voidout_le64(u64 __iomem *addr, u64 val)
Quoted 5 lines
{ out_le32((u32 *)addr, (u32)val); out_le32((u32 *)addr + 1, val >> 32); }=20
And I agree with your other comments.
Thanks a lot!
- zw
Re: [PATCH 5/5] Add DMA engine driver for Freescale MPC85xxprocessors.
Quoted 7 lines · On Thu, Sep 13, 2007 at 03:13:06AM -0700, Zhang Wei-r63237 wrote:
Quoted 4 lines
After dropping the lock, you can no longer assume that your iterator is
still valid; you need to work off of the list head.
list_for_each_entry_safe()is used here. I think the safe should be ok. :P
Nope. The safety is against the particular item you're iterating on being removed; it doesn't protect against the *next* entry being removed when you drop the lock.
Quoted 4 lines
Quoted 1 line
Why not use an array of channels?
The list is used in dma engine core file. And it's possible that there are not all channel listed in dts and array.
I'm not sure I understand what you mean by the latter comment...
Quoted 6 lines
Quoted 4 lines
You could have the features be part of the match struct, so you don't have
to do extra strcmps.Can I use the data field of struct
of_device_id?
Yes, that's what it's there for. :-)
Quoted 7 lines
Quoted 5 lines
drivers/dma/fsldma.c line 965
Quoted 3 lines
drivers/dma/fsldma.c new file +3
-0+static struct of_device_id of_fsl_dma_ids[] = { + { .compatible ="fsl,dma" , }, +};Why do we need to bind to the parent node at all?
Yes, the MPC83xx should get interrupt source from DMA device register.
You don't need to bind to it for that, though -- just call of_get_parent from the channel probe. Though it might be easier to bind to the parent to ensure that you only register the IRQ once.
-Scott
Re: [PATCH 5/5] Add DMA engine driver for Freescale MPC85xxprocessors.
In reply to Zhang Wei-r63237Quoted 5 lines · On 9/13/07, Zhang Wei-r63237 <[email protected]> wrote:
Hi,
Quoted 3 lines
Review
Quoted 2 lines
(quoted diff) +2
-0+static void fsl_dma_set_src(dma_addr_t addr, + struct dma_async_tx_descriptor*tx, int index)
Quoted 9 lines
Quoted 5 lines
Quoted 1 line
+{
What is index supposed to mean? It's not used, or documented anywhere than
I can see.I've also got more document here. Hi, Dan, could you give me some explanation about this API? :)
The index field gets used for multi-source (or multi-dest) operations.
XOR, for example, is a multi-source operation. I am preparing a
documentation patch.
[..]
--
Dan
Quoted 4 lines
Hi, Dan,
Does I have followed your new API? :-)
[..]
Quoted 33 lines
Quoted 18 lines
Quoted 1 line
+static struct
dma_chan*of_find_dma_chan_by_phandle(phandle phandle)
drivers/dma/fsldma.c
Quoted 10 lines
drivers/dma/fsldma.c new file +10
-0+{ +struct device_node *np; +struct dma_chan *chan; +struct fsl_dma_device *fdev; + + np =of_find_node_by_phandle (phandle); +if (!np || !of_device_is_compatible (np->parent,"fsl,dma" )) +return NULL ; + + fdev =dev_get_drvdata(&of_find_device_by_node(np->parent)->dev);
Review
Quoted 2 lines
(quoted diff) +2
-0+ + list_for_each_entry(chan, &fdev->common.channels,
device_node)Quoted 1 line
+ if
(to_of_device(to_fsl_chan(chan)->chan_dev)->node == np)
Quoted 14 lines
drivers/dma/fsldma.c line 804
Quoted 4 lines
drivers/dma/fsldma.c new file +4
-0+return chan; +return NULL ; +} +EXPORT_SYMBOL (of_find_dma_chan_by_phandle);This routine implies that there is a piece of code somewhere that wants to select which channels it can use. A similar effect can be achieved by registering a
dma_clientwith the dmaengine interface ('dma_async_client_register'). Then when the client code makes a call to 'dma_async_client_chan_request' it receives a 'dma_event_callback' for each channel in the system. It will also be asynchronously notified of channels entering and leaving the system. The goal is to share a common infrastructure for channel management.
Quoted 1 line
It's speacial codes for our processors. Some device need the speacial DMA channel, such as must be DMA channel 0. So I add these codes. Or, is it possible to add a API for the special DMA channel getting?
Timur had mentioned that this is for device tree support, but your comment makes me think that this is for client support. This sounds like a case where you can define a dma_client to find a specific channel, something like:
http://marc.info/?l=linux-kernel&m=118417229619156&w=2
Quoted 50 lines
Quoted 50 lines
Quoted 20 lines
drivers/dma/fsldma.c new file +20
-0+ +static int __devinit of_fsl_dma_probe (struct of_device *dev, +const struct of_device_id *match) +{ +int err; +unsigned int irq; +struct fsl_dma_device *fdev; + + fdev =kzalloc (sizeof (struct fsl_dma_device ),GFP_KERNEL ); +if (!fdev) { +dev_err (&dev->dev,"No enough memory for 'priv'\n" ); + err = -ENOMEM ; + goto err; + } + fdev->dev = &dev->dev; +INIT_LIST_HEAD (&fdev->common.channels); + +/* get DMA controller register base */ + err =of_address_to_resource (dev->node,0 , &fdev->reg); +if (err) {drivers/dma/fsldma.c
Quoted 10 lines
drivers/dma/fsldma.c new file +10
-0+dev_err (&dev->dev,"Can't get %s property 'reg'\n" , + dev->node->full_name); + goto err; + } + +dev_info (&dev->dev,"Probe the Freescale DMA driver for %s " +"controller at 0x%08x...\n" , + match->compatible, fdev->reg.start); + fdev->reg_base = ioremap(fdev->reg.start, fdev->reg.end + -
fdev->reg.start+ 1);drivers/dma/fsldma.c
Quoted 3 lines
drivers/dma/fsldma.c new file +3
-0+ +dma_cap_set (DMA_MEMCPY , fdev->common.cap_mask); + fdev->common.device_alloc_chan_resources =
fsl_dma_alloc_chan_resources;Quoted 1 line
+
fdev->common.device_free_chan_resources=
fsl_dma_free_chan_resources;drivers/dma/fsldma.c
Quoted 3 lines
drivers/dma/fsldma.c new file +3
-0+ fdev->common.device_prep_dma_memcpy = fsl_dma_prep_memcpy; + fdev->common.device_is_tx_complete = fsl_dma_is_complete; + fdev->common.device_issue_pending =
fsl_dma_memcpy_issue_pending;Quoted 1 line
+
fdev->common.device_dependency_added=
fsl_dma_dependency_added;drivers/dma/fsldma.c line 844
Quoted 2 lines
drivers/dma/fsldma.c new file +2
-0+ fdev->common.dev = &dev->dev; +If this driver adds:
dma_cap_set(DMA_INTERRUPT, fdev->common.cap_mask);fdev->common.device_prep_dma_interrupt=fsl_dma_prep_interrupt;
Quoted 7 lines
Quoted 4 lines
It will be able to take advantage of interrupt triggered callbacks in
async_tx. Without these changesasync_txwill poll for the completion of each transaction.The new API have lacking documents :) I'll make some study here.
Yes, I will address that...
Quoted 2 lines
Thanks!
- zw
Regards,
Dan