Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1281828 > unrolled thread
| Started by | Peter Ujfalusi <peter.ujfalusi@ti.com> |
|---|---|
| First post | 2015-12-02 15:10 +0100 |
| Last post | 2015-12-02 15:40 +0100 |
| Articles | 8 — 2 participants |
Back to article view | Back to linux.kernel
[RFC v03 00/15] dmaengine: New 'universal' API for requesting channel Peter Ujfalusi <peter.ujfalusi@ti.com> - 2015-12-02 15:10 +0100
[RFC v03 08/15] ARM: davinci: dm644x: Add dma_filter_map to edma Peter Ujfalusi <peter.ujfalusi@ti.com> - 2015-12-02 15:10 +0100
[RFC v03 15/15] ARM: davinci: dm365: Remove DMA resources for SPI Peter Ujfalusi <peter.ujfalusi@ti.com> - 2015-12-02 15:10 +0100
[RFC v03 05/15] ARM: davinci: devices-da8xx: Add dma_filter_map to edma Peter Ujfalusi <peter.ujfalusi@ti.com> - 2015-12-02 15:10 +0100
[RFC v03 01/15] dmaengine: core: Skip mask matching when it is not provided to private_candidate Peter Ujfalusi <peter.ujfalusi@ti.com> - 2015-12-02 15:10 +0100
[RFC v03 04/15] dmaengine: edma: Add support for DMA filter mapping to slave devices Peter Ujfalusi <peter.ujfalusi@ti.com> - 2015-12-02 15:10 +0100
[RFC v03 06/15] ARM: davinci: dm355: Add dma_filter_map to edma Peter Ujfalusi <peter.ujfalusi@ti.com> - 2015-12-02 15:10 +0100
Re: [RFC v03 00/15] dmaengine: New 'universal' API for requesting channel Andy Shevchenko <andy.shevchenko@gmail.com> - 2015-12-02 15:40 +0100
| From | Peter Ujfalusi <peter.ujfalusi@ti.com> |
|---|---|
| Date | 2015-12-02 15:10 +0100 |
| Subject | [RFC v03 00/15] dmaengine: New 'universal' API for requesting channel |
| Message-ID | <qBggx-8db-3@gated-at.bofh.it> |
Hi,
I keep this still as RFC.
Changes since RFC v02:
- Using has_acpi_companion() instead ACPI_HANDLE()
- mask matching change within private_candidate()
- Fallback in dma_request_chan() when DT/ACPI lookup fails.
- Rename dma_get_channel() -> find_candidate()
- Arch code changes as suggested by Arnd
- Some documentation updated, more need to be done.
Changes since RFC v01:
- dma_request_chan(); lost the mask parameter
- The new API does not rely on RESOURCE_DMA, instead the dma_filter_map table
will be used to provide the needed information to the filter function in
legacy mode
- Extended the example patches to convert most of daVinci to use the new API to
request the DMA channels.
TODO: Documentation update ;)
As it has been discussed in the following thread:
http://www.gossamer-threads.com/lists/linux/kernel/2181487#2181487
Andy: I did looked at the unified device properties, but I decided to not to use
it as I don't see it to fit well and most of the legacy board files are using
resources to specify at least their memory regions so adding the DMA resource
to them would be more inline with the rest of the code.
The ARM, mmc and spi patches are converting daVinci drivers board files to use
the new method of requesting DMA channel.
With this series I have taken a path which would result two new API, which can
be used to convert most of the current users already and with some work all
users might be able to move to this set.
With this set the filter_fn used for legacy (non DT/ACPI) channel request is no
longer needed to be exported to client drivers since the selection of the
correct filter_fn will be done in the core.
So, the first proposal is to have:
struct dma_chan *dma_request_chan(struct device *dev, const char *name);
struct dma_chan *dma_request_chan_by_mask(const dma_cap_mask_t *mask);
The dma_request_chan_by_mask() is to request any channel matching with the
requested capabilities, can be used to request channel for memcpy, memset, xor,
etc where no hardware synchronization is needed.
The dma_request_chan() is to request a slave channel. The dma_request_chan() will try to find the
channel via DT, ACPI or in case if the kernel booted in non DT/ACPI mode
it will use a filter lookup table and retrieves the needed information from
the dma_filter_map provided by the DMA drivers.
This legacy mode needs changes in platform code, in dmaengine drivers and
finally the dmaengine user drivers can be converted:
For each dmaengine driver an array of DMA device, slave and the parameter
for the filter function needs to be added:
static const struct dma_filter_map da830_edma_map[] = {
{ "davinci-mcasp.0", "rx", EDMA_FILTER_PARAM(0, 0) },
{ "davinci-mcasp.0", "tx", EDMA_FILTER_PARAM(0, 1) },
{ "davinci-mcasp.1", "rx", EDMA_FILTER_PARAM(0, 2) },
{ "davinci-mcasp.1", "tx", EDMA_FILTER_PARAM(0, 3) },
{ "davinci-mcasp.2", "rx", EDMA_FILTER_PARAM(0, 4) },
{ "davinci-mcasp.2", "tx", EDMA_FILTER_PARAM(0, 5) },
{ "spi_davinci.0", "rx", EDMA_FILTER_PARAM(0, 14) },
{ "spi_davinci.0", "tx", EDMA_FILTER_PARAM(0, 15) },
{ "da830-mmc.0", "rx", EDMA_FILTER_PARAM(0, 16) },
{ "da830-mmc.0", "tx", EDMA_FILTER_PARAM(0, 17) },
{ "spi_davinci.1", "rx", EDMA_FILTER_PARAM(0, 18) },
{ "spi_davinci.1", "tx", EDMA_FILTER_PARAM(0, 19) },
};
This information is going to be needed by the dmaengine driver, so
modification to the platform_data is needed, and the driver map should be
added to the pdata of the DMA driver:
da8xx_edma0_pdata.slave_map = da830_edma_map;
da8xx_edma0_pdata.slavecnt = ARRAY_SIZE(da830_edma_map);
The DMA driver then needs to configure the needed device -> filter_fn
mapping before it registers with dma_async_device_register() :
if (info->slave_map) {
ecc->dma_slave.filter_map.map = info->slave_map;
ecc->dma_slave.filter_map.mapcnt = info->slavecnt;
ecc->dma_slave.filter_map.filter_fn = edma_filter_fn;
}
When neither DT or ACPI lookup is available the dma_request_chan() will
try to match the requester's device name with the filter_map's list of
device names, when a match found it will use the information from the
dma_filter_map to get the channel with the dma_get_channel() internal
function.
Regards,
Peter
---
Peter Ujfalusi (15):
dmaengine: core: Skip mask matching when it is not provided to
private_candidate
dmaengine: core: Move and merge the code paths using private_candidate
dmaengine: core: Introduce new, universal API to request a channel
dmaengine: edma: Add support for DMA filter mapping to slave devices
ARM: davinci: devices-da8xx: Add dma_filter_map to edma
ARM: davinci: dm355: Add dma_filter_map to edma
ARM: davinci: dm365: Add dma_filter_map to edma
ARM: davinci: dm644x: Add dma_filter_map to edma
ARM: davinci: dm646x: Add dma_filter_map to edma
mmc: davinci_mmc: Use dma_request_chan() to requesting DMA channel
spi: davinci: Use dma_request_chan() to requesting DMA channel
ARM: davinci: devices-da8xx: Remove DMA resources for MMC and SPI
ARM: davinci: devices: Remove DMA resources for MMC
ARM: davinci: dm355: Remove DMA resources for SPI
ARM: davinci: dm365: Remove DMA resources for SPI
Documentation/dmaengine/client.txt | 23 ++---
arch/arm/mach-davinci/devices-da8xx.c | 95 +++++++++---------
arch/arm/mach-davinci/devices.c | 19 ----
arch/arm/mach-davinci/dm355.c | 28 ++++--
arch/arm/mach-davinci/dm365.c | 30 ++++--
arch/arm/mach-davinci/dm644x.c | 12 +++
arch/arm/mach-davinci/dm646x.c | 11 +++
drivers/dma/dmaengine.c | 181 ++++++++++++++++++++++++++--------
drivers/dma/edma.c | 6 ++
drivers/mmc/host/davinci_mmc.c | 52 +++-------
drivers/spi/spi-davinci.c | 76 +++++---------
include/linux/dmaengine.h | 27 +++++
include/linux/platform_data/edma.h | 7 ++
13 files changed, 336 insertions(+), 231 deletions(-)
--
2.6.3
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [next] | [standalone]
| From | Peter Ujfalusi <peter.ujfalusi@ti.com> |
|---|---|
| Date | 2015-12-02 15:10 +0100 |
| Subject | [RFC v03 08/15] ARM: davinci: dm644x: Add dma_filter_map to edma |
| Message-ID | <qBggA-8db-37@gated-at.bofh.it> |
| In reply to | #1281828 |
Provide the dma_filter_map to edma which will allow us to move the drivers
to the new, simpler dmaengine API and we can remove the DMA resources also
for the devices.
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
---
arch/arm/mach-davinci/dm644x.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/arch/arm/mach-davinci/dm644x.c b/arch/arm/mach-davinci/dm644x.c
index d38f5049d56e..59fae2c3b8f4 100644
--- a/arch/arm/mach-davinci/dm644x.c
+++ b/arch/arm/mach-davinci/dm644x.c
@@ -11,6 +11,7 @@
#include <linux/init.h>
#include <linux/clk.h>
#include <linux/serial_8250.h>
+#include <linux/dmaengine.h>
#include <linux/platform_device.h>
#include <linux/platform_data/edma.h>
#include <linux/platform_data/gpio-davinci.h>
@@ -505,9 +506,20 @@ static s8 queue_priority_mapping[][2] = {
{-1, -1},
};
+static const struct dma_filter_map da644x_edma_map[] = {
+ { "davinci-mcbsp", "tx", EDMA_FILTER_PARAM(0, 2) },
+ { "davinci-mcbsp", "rx", EDMA_FILTER_PARAM(0, 3) },
+ { "spi_davinci", "tx", EDMA_FILTER_PARAM(0, 16) },
+ { "spi_davinci", "rx", EDMA_FILTER_PARAM(0, 17) },
+ { "dm6441-mmc.0", "rx", EDMA_FILTER_PARAM(0, 26) },
+ { "dm6441-mmc.0", "tx", EDMA_FILTER_PARAM(0, 27) },
+};
+
static struct edma_soc_info dm644x_edma_pdata = {
.queue_priority_mapping = queue_priority_mapping,
.default_queue = EVENTQ_1,
+ .slave_map = da644x_edma_map,
+ .slavecnt = ARRAY_SIZE(da644x_edma_map),
};
static struct resource edma_resources[] = {
--
2.6.3
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Peter Ujfalusi <peter.ujfalusi@ti.com> |
|---|---|
| Date | 2015-12-02 15:10 +0100 |
| Subject | [RFC v03 15/15] ARM: davinci: dm365: Remove DMA resources for SPI |
| Message-ID | <qBggA-8db-39@gated-at.bofh.it> |
| In reply to | #1281828 |
The driver is converted to not use the DMA resource.
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
---
arch/arm/mach-davinci/dm365.c | 8 --------
1 file changed, 8 deletions(-)
diff --git a/arch/arm/mach-davinci/dm365.c b/arch/arm/mach-davinci/dm365.c
index e794bff7d589..664ee6bbef22 100644
--- a/arch/arm/mach-davinci/dm365.c
+++ b/arch/arm/mach-davinci/dm365.c
@@ -660,14 +660,6 @@ static struct resource dm365_spi0_resources[] = {
.start = IRQ_DM365_SPIINT0_0,
.flags = IORESOURCE_IRQ,
},
- {
- .start = 17,
- .flags = IORESOURCE_DMA,
- },
- {
- .start = 16,
- .flags = IORESOURCE_DMA,
- },
};
static struct platform_device dm365_spi0_device = {
--
2.6.3
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Peter Ujfalusi <peter.ujfalusi@ti.com> |
|---|---|
| Date | 2015-12-02 15:10 +0100 |
| Subject | [RFC v03 05/15] ARM: davinci: devices-da8xx: Add dma_filter_map to edma |
| Message-ID | <qBggA-8db-53@gated-at.bofh.it> |
| In reply to | #1281828 |
Provide the dma_filter_map to edma which will allow us to move the drivers
to the new, simpler dmaengine API and we can remove the DMA resources also
for the devices.
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
---
arch/arm/mach-davinci/devices-da8xx.c | 46 +++++++++++++++++++++++++++++++++++
1 file changed, 46 insertions(+)
diff --git a/arch/arm/mach-davinci/devices-da8xx.c b/arch/arm/mach-davinci/devices-da8xx.c
index 28c90bc372bd..9ffdcd5de0f8 100644
--- a/arch/arm/mach-davinci/devices-da8xx.c
+++ b/arch/arm/mach-davinci/devices-da8xx.c
@@ -17,6 +17,7 @@
#include <linux/ahci_platform.h>
#include <linux/clk.h>
#include <linux/reboot.h>
+#include <linux/dmaengine.h>
#include <mach/cputype.h>
#include <mach/common.h>
@@ -233,16 +234,54 @@ static const struct platform_device_info da850_edma1_device __initconst = {
.size_data = sizeof(da850_edma1_pdata),
};
+static const struct dma_filter_map da830_edma_map[] = {
+ { "davinci-mcasp.0", "rx", EDMA_FILTER_PARAM(0, 0) },
+ { "davinci-mcasp.0", "tx", EDMA_FILTER_PARAM(0, 1) },
+ { "davinci-mcasp.1", "rx", EDMA_FILTER_PARAM(0, 2) },
+ { "davinci-mcasp.1", "tx", EDMA_FILTER_PARAM(0, 3) },
+ { "davinci-mcasp.2", "rx", EDMA_FILTER_PARAM(0, 4) },
+ { "davinci-mcasp.2", "tx", EDMA_FILTER_PARAM(0, 5) },
+ { "spi_davinci.0", "rx", EDMA_FILTER_PARAM(0, 14) },
+ { "spi_davinci.0", "tx", EDMA_FILTER_PARAM(0, 15) },
+ { "da830-mmc.0", "rx", EDMA_FILTER_PARAM(0, 16) },
+ { "da830-mmc.0", "tx", EDMA_FILTER_PARAM(0, 17) },
+ { "spi_davinci.1", "rx", EDMA_FILTER_PARAM(0, 18) },
+ { "spi_davinci.1", "tx", EDMA_FILTER_PARAM(0, 19) },
+};
+
int __init da830_register_edma(struct edma_rsv_info *rsv)
{
struct platform_device *edma_pdev;
da8xx_edma0_pdata.rsv = rsv;
+ da8xx_edma0_pdata.slave_map = da830_edma_map;
+ da8xx_edma0_pdata.slavecnt = ARRAY_SIZE(da830_edma_map);
+
edma_pdev = platform_device_register_full(&da8xx_edma0_device);
return IS_ERR(edma_pdev) ? PTR_ERR(edma_pdev) : 0;
}
+static const struct dma_filter_map da850_edma0_map[] = {
+ { "davinci-mcasp.0", "rx", EDMA_FILTER_PARAM(0, 0) },
+ { "davinci-mcasp.0", "tx", EDMA_FILTER_PARAM(0, 1) },
+ { "davinci-mcbsp.0", "rx", EDMA_FILTER_PARAM(0, 2) },
+ { "davinci-mcbsp.0", "tx", EDMA_FILTER_PARAM(0, 3) },
+ { "davinci-mcbsp.1", "rx", EDMA_FILTER_PARAM(0, 4) },
+ { "davinci-mcbsp.1", "tx", EDMA_FILTER_PARAM(0, 5) },
+ { "spi_davinci.0", "rx", EDMA_FILTER_PARAM(0, 14) },
+ { "spi_davinci.0", "tx", EDMA_FILTER_PARAM(0, 15) },
+ { "da830-mmc.0", "rx", EDMA_FILTER_PARAM(0, 16) },
+ { "da830-mmc.0", "tx", EDMA_FILTER_PARAM(0, 17) },
+ { "spi_davinci.1", "rx", EDMA_FILTER_PARAM(0, 18) },
+ { "spi_davinci.1", "tx", EDMA_FILTER_PARAM(0, 19) },
+};
+
+static const struct dma_filter_map da850_edma1_map[] = {
+ { "da830-mmc.1", "tx", EDMA_FILTER_PARAM(0, 28) },
+ { "da830-mmc.1", "rx", EDMA_FILTER_PARAM(0, 29) },
+};
+
int __init da850_register_edma(struct edma_rsv_info *rsv[2])
{
struct platform_device *edma_pdev;
@@ -252,11 +291,18 @@ int __init da850_register_edma(struct edma_rsv_info *rsv[2])
da850_edma1_pdata.rsv = rsv[1];
}
+ da8xx_edma0_pdata.slave_map = da850_edma0_map;
+ da8xx_edma0_pdata.slavecnt = ARRAY_SIZE(da850_edma0_map);
+
edma_pdev = platform_device_register_full(&da8xx_edma0_device);
if (IS_ERR(edma_pdev)) {
pr_warn("%s: Failed to register eDMA0\n", __func__);
return PTR_ERR(edma_pdev);
}
+
+ da850_edma1_pdata.slave_map = da850_edma1_map;
+ da850_edma1_pdata.slavecnt = ARRAY_SIZE(da850_edma1_map);
+
edma_pdev = platform_device_register_full(&da850_edma1_device);
return IS_ERR(edma_pdev) ? PTR_ERR(edma_pdev) : 0;
}
--
2.6.3
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Peter Ujfalusi <peter.ujfalusi@ti.com> |
|---|---|
| Date | 2015-12-02 15:10 +0100 |
| Subject | [RFC v03 01/15] dmaengine: core: Skip mask matching when it is not provided to private_candidate |
| Message-ID | <qBggA-8db-57@gated-at.bofh.it> |
| In reply to | #1281828 |
If mask is NULL skip the mask matching against the DMA device capabilities.
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
---
drivers/dma/dmaengine.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/dma/dmaengine.c b/drivers/dma/dmaengine.c
index daf54a39bcc7..6311e1fc80be 100644
--- a/drivers/dma/dmaengine.c
+++ b/drivers/dma/dmaengine.c
@@ -515,7 +515,7 @@ static struct dma_chan *private_candidate(const dma_cap_mask_t *mask,
{
struct dma_chan *chan;
- if (!__dma_device_satisfies_mask(dev, mask)) {
+ if (mask && !__dma_device_satisfies_mask(dev, mask)) {
pr_debug("%s: wrong capabilities\n", __func__);
return NULL;
}
--
2.6.3
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Peter Ujfalusi <peter.ujfalusi@ti.com> |
|---|---|
| Date | 2015-12-02 15:10 +0100 |
| Subject | [RFC v03 04/15] dmaengine: edma: Add support for DMA filter mapping to slave devices |
| Message-ID | <qBggB-8db-69@gated-at.bofh.it> |
| In reply to | #1281828 |
Add support for providing device to filter_fn mapping so client drivers
can switch to use the dma_request_chan() API.
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
---
drivers/dma/edma.c | 6 ++++++
include/linux/platform_data/edma.h | 7 +++++++
2 files changed, 13 insertions(+)
diff --git a/drivers/dma/edma.c b/drivers/dma/edma.c
index 0675e268d577..46b305ea0d21 100644
--- a/drivers/dma/edma.c
+++ b/drivers/dma/edma.c
@@ -2297,6 +2297,12 @@ static int edma_probe(struct platform_device *pdev)
edma_set_chmap(&ecc->slave_chans[i], ecc->dummy_slot);
}
+ if (info->slave_map) {
+ ecc->dma_slave.filter_map.map = info->slave_map;
+ ecc->dma_slave.filter_map.mapcnt = info->slavecnt;
+ ecc->dma_slave.filter_map.filter_fn = edma_filter_fn;
+ }
+
ret = dma_async_device_register(&ecc->dma_slave);
if (ret) {
dev_err(dev, "slave ddev registration failed (%d)\n", ret);
diff --git a/include/linux/platform_data/edma.h b/include/linux/platform_data/edma.h
index e2878baeb90e..4e78a946e0c1 100644
--- a/include/linux/platform_data/edma.h
+++ b/include/linux/platform_data/edma.h
@@ -53,12 +53,16 @@ enum dma_event_q {
#define EDMA_CTLR(i) ((i) >> 16)
#define EDMA_CHAN_SLOT(i) ((i) & 0xffff)
+#define EDMA_FILTER_PARAM(ctlr, chan) ((int[]) { EDMA_CTLR_CHAN(ctlr, chan) })
+
struct edma_rsv_info {
const s16 (*rsv_chans)[2];
const s16 (*rsv_slots)[2];
};
+struct dma_filter_map;
+
/* platform_data for EDMA driver */
struct edma_soc_info {
/*
@@ -76,6 +80,9 @@ struct edma_soc_info {
s8 (*queue_priority_mapping)[2];
const s16 (*xbar_chans)[2];
+
+ const struct dma_filter_map *slave_map;
+ int slavecnt;
};
#endif
--
2.6.3
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Peter Ujfalusi <peter.ujfalusi@ti.com> |
|---|---|
| Date | 2015-12-02 15:10 +0100 |
| Subject | [RFC v03 06/15] ARM: davinci: dm355: Add dma_filter_map to edma |
| Message-ID | <qBggA-8db-61@gated-at.bofh.it> |
| In reply to | #1281828 |
Provide the dma_filter_map to edma which will allow us to move the drivers
to the new, simpler dmaengine API and we can remove the DMA resources also
for the devices.
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
---
arch/arm/mach-davinci/dm355.c | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/arch/arm/mach-davinci/dm355.c b/arch/arm/mach-davinci/dm355.c
index 609950b8c191..ee7656fa0c52 100644
--- a/arch/arm/mach-davinci/dm355.c
+++ b/arch/arm/mach-davinci/dm355.c
@@ -13,6 +13,7 @@
#include <linux/serial_8250.h>
#include <linux/platform_device.h>
#include <linux/dma-mapping.h>
+#include <linux/dmaengine.h>
#include <linux/spi/spi.h>
#include <linux/platform_data/edma.h>
#include <linux/platform_data/gpio-davinci.h>
@@ -576,9 +577,28 @@ static s8 queue_priority_mapping[][2] = {
{-1, -1},
};
+static const struct dma_filter_map da355_edma_map[] = {
+ { "davinci-mcbsp.0", "tx", EDMA_FILTER_PARAM(0, 2) },
+ { "davinci-mcbsp.0", "rx", EDMA_FILTER_PARAM(0, 3) },
+ { "davinci-mcbsp.1", "tx", EDMA_FILTER_PARAM(0, 8) },
+ { "davinci-mcbsp.1", "rx", EDMA_FILTER_PARAM(0, 9) },
+ { "spi_davinci.2", "tx", EDMA_FILTER_PARAM(0, 10) },
+ { "spi_davinci.2", "rx", EDMA_FILTER_PARAM(0, 11) },
+ { "spi_davinci.1", "tx", EDMA_FILTER_PARAM(0, 14) },
+ { "spi_davinci.1", "rx", EDMA_FILTER_PARAM(0, 15) },
+ { "spi_davinci.0", "tx", EDMA_FILTER_PARAM(0, 16) },
+ { "spi_davinci.0", "rx", EDMA_FILTER_PARAM(0, 17) },
+ { "dm6441-mmc.0", "rx", EDMA_FILTER_PARAM(0, 26) },
+ { "dm6441-mmc.0", "tx", EDMA_FILTER_PARAM(0, 27) },
+ { "dm6441-mmc.1", "rx", EDMA_FILTER_PARAM(0, 30) },
+ { "dm6441-mmc.1", "tx", EDMA_FILTER_PARAM(0, 31) },
+};
+
static struct edma_soc_info dm355_edma_pdata = {
.queue_priority_mapping = queue_priority_mapping,
.default_queue = EVENTQ_1,
+ .slave_map = da355_edma_map,
+ .slavecnt = ARRAY_SIZE(da355_edma_map),
};
static struct resource edma_resources[] = {
--
2.6.3
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Andy Shevchenko <andy.shevchenko@gmail.com> |
|---|---|
| Date | 2015-12-02 15:40 +0100 |
| Message-ID | <qBgJz-8no-15@gated-at.bofh.it> |
| In reply to | #1281828 |
On Wed, Dec 2, 2015 at 3:59 PM, Peter Ujfalusi <peter.ujfalusi@ti.com> wrote:
> Hi,
>
> I keep this still as RFC.
>
> Changes since RFC v02:
> - Using has_acpi_companion() instead ACPI_HANDLE()
> - mask matching change within private_candidate()
> - Fallback in dma_request_chan() when DT/ACPI lookup fails.
> - Rename dma_get_channel() -> find_candidate()
> - Arch code changes as suggested by Arnd
> - Some documentation updated, more need to be done.
>
> Changes since RFC v01:
> - dma_request_chan(); lost the mask parameter
> - The new API does not rely on RESOURCE_DMA, instead the dma_filter_map table
> will be used to provide the needed information to the filter function in
> legacy mode
> - Extended the example patches to convert most of daVinci to use the new API to
> request the DMA channels.
>
> TODO: Documentation update ;)
>
> As it has been discussed in the following thread:
> http://www.gossamer-threads.com/lists/linux/kernel/2181487#2181487
>
> Andy: I did looked at the unified device properties, but I decided to not to use
> it as I don't see it to fit well and most of the legacy board files are using
> resources to specify at least their memory regions so adding the DMA resource
> to them would be more inline with the rest of the code.
>
> The ARM, mmc and spi patches are converting daVinci drivers board files to use
> the new method of requesting DMA channel.
>
> With this series I have taken a path which would result two new API, which can
> be used to convert most of the current users already and with some work all
> users might be able to move to this set.
> With this set the filter_fn used for legacy (non DT/ACPI) channel request is no
> longer needed to be exported to client drivers since the selection of the
> correct filter_fn will be done in the core.
>
> So, the first proposal is to have:
>
> struct dma_chan *dma_request_chan(struct device *dev, const char *name);
> struct dma_chan *dma_request_chan_by_mask(const dma_cap_mask_t *mask);
>
> The dma_request_chan_by_mask() is to request any channel matching with the
> requested capabilities, can be used to request channel for memcpy, memset, xor,
> etc where no hardware synchronization is needed.
>
> The dma_request_chan() is to request a slave channel. The dma_request_chan() will try to find the
> channel via DT, ACPI or in case if the kernel booted in non DT/ACPI mode
> it will use a filter lookup table and retrieves the needed information from
> the dma_filter_map provided by the DMA drivers.
> This legacy mode needs changes in platform code, in dmaengine drivers and
> finally the dmaengine user drivers can be converted:
>
> For each dmaengine driver an array of DMA device, slave and the parameter
> for the filter function needs to be added:
>
> static const struct dma_filter_map da830_edma_map[] = {
> { "davinci-mcasp.0", "rx", EDMA_FILTER_PARAM(0, 0) },
> { "davinci-mcasp.0", "tx", EDMA_FILTER_PARAM(0, 1) },
> { "davinci-mcasp.1", "rx", EDMA_FILTER_PARAM(0, 2) },
> { "davinci-mcasp.1", "tx", EDMA_FILTER_PARAM(0, 3) },
> { "davinci-mcasp.2", "rx", EDMA_FILTER_PARAM(0, 4) },
> { "davinci-mcasp.2", "tx", EDMA_FILTER_PARAM(0, 5) },
> { "spi_davinci.0", "rx", EDMA_FILTER_PARAM(0, 14) },
> { "spi_davinci.0", "tx", EDMA_FILTER_PARAM(0, 15) },
> { "da830-mmc.0", "rx", EDMA_FILTER_PARAM(0, 16) },
> { "da830-mmc.0", "tx", EDMA_FILTER_PARAM(0, 17) },
> { "spi_davinci.1", "rx", EDMA_FILTER_PARAM(0, 18) },
> { "spi_davinci.1", "tx", EDMA_FILTER_PARAM(0, 19) },
> };
>
> This information is going to be needed by the dmaengine driver, so
> modification to the platform_data is needed, and the driver map should be
> added to the pdata of the DMA driver:
>
> da8xx_edma0_pdata.slave_map = da830_edma_map;
> da8xx_edma0_pdata.slavecnt = ARRAY_SIZE(da830_edma_map);
>
> The DMA driver then needs to configure the needed device -> filter_fn
> mapping before it registers with dma_async_device_register() :
>
> if (info->slave_map) {
> ecc->dma_slave.filter_map.map = info->slave_map;
> ecc->dma_slave.filter_map.mapcnt = info->slavecnt;
> ecc->dma_slave.filter_map.filter_fn = edma_filter_fn;
> }
>
> When neither DT or ACPI lookup is available the dma_request_chan() will
> try to match the requester's device name with the filter_map's list of
> device names, when a match found it will use the information from the
> dma_filter_map to get the channel with the dma_get_channel() internal
> function.
>
I like patches 1 & 2 in current shape.
Though few comments to patch 3.
> Regards,
> Peter
> ---
> Peter Ujfalusi (15):
> dmaengine: core: Skip mask matching when it is not provided to
> private_candidate
> dmaengine: core: Move and merge the code paths using private_candidate
> dmaengine: core: Introduce new, universal API to request a channel
> dmaengine: edma: Add support for DMA filter mapping to slave devices
> ARM: davinci: devices-da8xx: Add dma_filter_map to edma
> ARM: davinci: dm355: Add dma_filter_map to edma
> ARM: davinci: dm365: Add dma_filter_map to edma
> ARM: davinci: dm644x: Add dma_filter_map to edma
> ARM: davinci: dm646x: Add dma_filter_map to edma
> mmc: davinci_mmc: Use dma_request_chan() to requesting DMA channel
> spi: davinci: Use dma_request_chan() to requesting DMA channel
> ARM: davinci: devices-da8xx: Remove DMA resources for MMC and SPI
> ARM: davinci: devices: Remove DMA resources for MMC
> ARM: davinci: dm355: Remove DMA resources for SPI
> ARM: davinci: dm365: Remove DMA resources for SPI
>
> Documentation/dmaengine/client.txt | 23 ++---
> arch/arm/mach-davinci/devices-da8xx.c | 95 +++++++++---------
> arch/arm/mach-davinci/devices.c | 19 ----
> arch/arm/mach-davinci/dm355.c | 28 ++++--
> arch/arm/mach-davinci/dm365.c | 30 ++++--
> arch/arm/mach-davinci/dm644x.c | 12 +++
> arch/arm/mach-davinci/dm646x.c | 11 +++
> drivers/dma/dmaengine.c | 181 ++++++++++++++++++++++++++--------
> drivers/dma/edma.c | 6 ++
> drivers/mmc/host/davinci_mmc.c | 52 +++-------
> drivers/spi/spi-davinci.c | 76 +++++---------
> include/linux/dmaengine.h | 27 +++++
> include/linux/platform_data/edma.h | 7 ++
> 13 files changed, 336 insertions(+), 231 deletions(-)
>
> --
> 2.6.3
>
--
With Best Regards,
Andy Shevchenko
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web