2018-04-02 14:29:10

by Robert Jarzmik

[permalink] [raw]
Subject: [PATCH 00/15] ARM: pxa: switch to DMA slave maps

Hi,

This serie is aimed at removing the dmaengine slave compat use, and transfer
knowledge of the DMA requestors into architecture code.

This was discussed/advised by Arnd a couple of years back, it's almost time.

The serie is divided in 3 phasees :
- phase 1 : patch 1/15 and patch 2/15
=> this is the preparation work
- phase 2 : patches 3/15 .. 10/15
=> this is the switch of all the drivers
=> this one will require either an Ack of the maintainers or be taken by them
once phase 1 is merged
- phase 3 : patches 11/15
=> this is the last part, cleanup and removal of export of the DMA filter
function

As this looks like a patch bomb, each maintainer expressing for his tree either
an Ack or "I want to take through my tree" will be spared in the next iterations
of this serie.

Several of these changes have been tested on actual hardware, including :
- pxamci
- pxa_camera
- smc*
- ASoC and SSP

Happy review.

Robert Jarzmik (15):
dmaengine: pxa: use a dma slave map
ARM: pxa: add dma slave map
mmc: pxamci: remove the dmaengine compat need
media: pxa_camera: remove the dmaengine compat need
mtd: nand: pxa3xx: remove the dmaengine compat need
net: smc911x: remove the dmaengine compat need
net: smc91x: remove the dmaengine compat need
ASoC: pxa: remove the dmaengine compat need
net: irda: pxaficp_ir: remove the dmaengine compat need
ata: pata_pxa: remove the dmaengine compat need
dmaengine: pxa: document pxad_param
dmaengine: pxa: make the filter function internal
ARM: pxa: remove the DMA IO resources
ARM: pxa: change SSP devices allocation
ARM: pxa: change SSP DMA channels allocation

arch/arm/mach-pxa/devices.c | 269 ++++++++++++++----------------
arch/arm/mach-pxa/devices.h | 14 +-
arch/arm/mach-pxa/include/mach/audio.h | 12 ++
arch/arm/mach-pxa/pxa25x.c | 4 +-
arch/arm/mach-pxa/pxa27x.c | 4 +-
arch/arm/mach-pxa/pxa3xx.c | 5 +-
arch/arm/plat-pxa/ssp.c | 50 +-----
drivers/ata/pata_pxa.c | 10 +-
drivers/dma/pxa_dma.c | 13 +-
drivers/media/platform/pxa_camera.c | 22 +--
drivers/mmc/host/pxamci.c | 29 +---
drivers/mtd/nand/pxa3xx_nand.c | 10 +-
drivers/net/ethernet/smsc/smc911x.c | 16 +-
drivers/net/ethernet/smsc/smc91x.c | 12 +-
drivers/net/ethernet/smsc/smc91x.h | 1 -
drivers/staging/irda/drivers/pxaficp_ir.c | 14 +-
include/linux/dma/pxa-dma.h | 20 +--
include/linux/platform_data/mmp_dma.h | 4 +
include/linux/pxa2xx_ssp.h | 4 +-
sound/arm/pxa2xx-ac97.c | 14 +-
sound/arm/pxa2xx-pcm-lib.c | 6 +-
sound/soc/pxa/pxa-ssp.c | 5 +-
sound/soc/pxa/pxa2xx-ac97.c | 32 +---
23 files changed, 196 insertions(+), 374 deletions(-)

--
2.11.0



2018-04-02 14:29:10

by Robert Jarzmik

[permalink] [raw]
Subject: [PATCH 01/15] dmaengine: pxa: use a dma slave map

In order to remove the specific knowledge of the dma mapping from PXA
drivers, add a default slave map for pxa architectures.

This won't impact MMP architecture, but is aimed only at all PXA boards.

This is the first step, and once all drivers are converted,
pxad_filter_fn() will be made static, and the DMA resources removed from
device.c.

Signed-off-by: Robert Jarzmik <[email protected]>
Reported-by: Arnd Bergmann <[email protected]>
---
drivers/dma/pxa_dma.c | 10 +++++++++-
include/linux/platform_data/mmp_dma.h | 4 ++++
2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/drivers/dma/pxa_dma.c b/drivers/dma/pxa_dma.c
index b53fb618bbf6..9505334f9c6e 100644
--- a/drivers/dma/pxa_dma.c
+++ b/drivers/dma/pxa_dma.c
@@ -179,6 +179,8 @@ static unsigned int pxad_drcmr(unsigned int line)
return 0x1000 + line * 4;
}

+bool pxad_filter_fn(struct dma_chan *chan, void *param);
+
/*
* Debug fs
*/
@@ -1396,9 +1398,10 @@ static int pxad_probe(struct platform_device *op)
{
struct pxad_device *pdev;
const struct of_device_id *of_id;
+ const struct dma_slave_map *slave_map = NULL;
struct mmp_dma_platdata *pdata = dev_get_platdata(&op->dev);
struct resource *iores;
- int ret, dma_channels = 0, nb_requestors = 0;
+ int ret, dma_channels = 0, nb_requestors = 0, slave_map_cnt = 0;
const enum dma_slave_buswidth widths =
DMA_SLAVE_BUSWIDTH_1_BYTE | DMA_SLAVE_BUSWIDTH_2_BYTES |
DMA_SLAVE_BUSWIDTH_4_BYTES;
@@ -1429,6 +1432,8 @@ static int pxad_probe(struct platform_device *op)
} else if (pdata && pdata->dma_channels) {
dma_channels = pdata->dma_channels;
nb_requestors = pdata->nb_requestors;
+ slave_map = pdata->slave_map;
+ slave_map_cnt = pdata->slave_map_cnt;
} else {
dma_channels = 32; /* default 32 channel */
}
@@ -1440,6 +1445,9 @@ static int pxad_probe(struct platform_device *op)
pdev->slave.device_prep_dma_memcpy = pxad_prep_memcpy;
pdev->slave.device_prep_slave_sg = pxad_prep_slave_sg;
pdev->slave.device_prep_dma_cyclic = pxad_prep_dma_cyclic;
+ pdev->slave.filter.map = slave_map;
+ pdev->slave.filter.mapcnt = slave_map_cnt;
+ pdev->slave.filter.fn = pxad_filter_fn;

pdev->slave.copy_align = PDMA_ALIGNMENT;
pdev->slave.src_addr_widths = widths;
diff --git a/include/linux/platform_data/mmp_dma.h b/include/linux/platform_data/mmp_dma.h
index d1397c8ed94e..6397b9c8149a 100644
--- a/include/linux/platform_data/mmp_dma.h
+++ b/include/linux/platform_data/mmp_dma.h
@@ -12,9 +12,13 @@
#ifndef MMP_DMA_H
#define MMP_DMA_H

+struct dma_slave_map;
+
struct mmp_dma_platdata {
int dma_channels;
int nb_requestors;
+ int slave_map_cnt;
+ const struct dma_slave_map *slave_map;
};

#endif /* MMP_DMA_H */
--
2.11.0


2018-04-02 14:29:23

by Robert Jarzmik

[permalink] [raw]
Subject: [PATCH 03/15] mmc: pxamci: remove the dmaengine compat need

As the pxa architecture switched towards the dmaengine slave map, the
old compatibility mechanism to acquire the dma requestor line number and
priority are not needed anymore.

This patch simplifies the dma resource acquisition, using the more
generic function dma_request_slave_channel().

Signed-off-by: Robert Jarzmik <[email protected]>
---
drivers/mmc/host/pxamci.c | 29 +++--------------------------
1 file changed, 3 insertions(+), 26 deletions(-)

diff --git a/drivers/mmc/host/pxamci.c b/drivers/mmc/host/pxamci.c
index c763b404510f..6c94474e36f4 100644
--- a/drivers/mmc/host/pxamci.c
+++ b/drivers/mmc/host/pxamci.c
@@ -24,7 +24,6 @@
#include <linux/interrupt.h>
#include <linux/dmaengine.h>
#include <linux/dma-mapping.h>
-#include <linux/dma/pxa-dma.h>
#include <linux/clk.h>
#include <linux/err.h>
#include <linux/mmc/host.h>
@@ -637,10 +636,8 @@ static int pxamci_probe(struct platform_device *pdev)
{
struct mmc_host *mmc;
struct pxamci_host *host = NULL;
- struct resource *r, *dmarx, *dmatx;
- struct pxad_param param_rx, param_tx;
+ struct resource *r;
int ret, irq, gpio_cd = -1, gpio_ro = -1, gpio_power = -1;
- dma_cap_mask_t mask;

ret = pxamci_of_init(pdev);
if (ret)
@@ -739,34 +736,14 @@ static int pxamci_probe(struct platform_device *pdev)

platform_set_drvdata(pdev, mmc);

- if (!pdev->dev.of_node) {
- dmarx = platform_get_resource(pdev, IORESOURCE_DMA, 0);
- dmatx = platform_get_resource(pdev, IORESOURCE_DMA, 1);
- if (!dmarx || !dmatx) {
- ret = -ENXIO;
- goto out;
- }
- param_rx.prio = PXAD_PRIO_LOWEST;
- param_rx.drcmr = dmarx->start;
- param_tx.prio = PXAD_PRIO_LOWEST;
- param_tx.drcmr = dmatx->start;
- }
-
- dma_cap_zero(mask);
- dma_cap_set(DMA_SLAVE, mask);
-
- host->dma_chan_rx =
- dma_request_slave_channel_compat(mask, pxad_filter_fn,
- &param_rx, &pdev->dev, "rx");
+ host->dma_chan_rx = dma_request_slave_channel(&pdev->dev, "rx");
if (host->dma_chan_rx == NULL) {
dev_err(&pdev->dev, "unable to request rx dma channel\n");
ret = -ENODEV;
goto out;
}

- host->dma_chan_tx =
- dma_request_slave_channel_compat(mask, pxad_filter_fn,
- &param_tx, &pdev->dev, "tx");
+ host->dma_chan_tx = dma_request_slave_channel(&pdev->dev, "tx");
if (host->dma_chan_tx == NULL) {
dev_err(&pdev->dev, "unable to request tx dma channel\n");
ret = -ENODEV;
--
2.11.0


2018-04-02 14:29:38

by Robert Jarzmik

[permalink] [raw]
Subject: [PATCH 05/15] mtd: nand: pxa3xx: remove the dmaengine compat need

From: Robert Jarzmik <[email protected]>

As the pxa architecture switched towards the dmaengine slave map, the
old compatibility mechanism to acquire the dma requestor line number and
priority are not needed anymore.

This patch simplifies the dma resource acquisition, using the more
generic function dma_request_slave_channel().

Signed-off-by: Robert Jarzmik <[email protected]>
---
drivers/mtd/nand/pxa3xx_nand.c | 10 +---------
1 file changed, 1 insertion(+), 9 deletions(-)

diff --git a/drivers/mtd/nand/pxa3xx_nand.c b/drivers/mtd/nand/pxa3xx_nand.c
index d1979c7dbe7e..4a56a0aef5b1 100644
--- a/drivers/mtd/nand/pxa3xx_nand.c
+++ b/drivers/mtd/nand/pxa3xx_nand.c
@@ -1518,8 +1518,6 @@ static int pxa3xx_nand_init_buff(struct pxa3xx_nand_info *info)
{
struct platform_device *pdev = info->pdev;
struct dma_slave_config config;
- dma_cap_mask_t mask;
- struct pxad_param param;
int ret;

info->data_buff = kmalloc(info->buf_size, GFP_KERNEL);
@@ -1533,13 +1531,7 @@ static int pxa3xx_nand_init_buff(struct pxa3xx_nand_info *info)
return ret;

sg_init_one(&info->sg, info->data_buff, info->buf_size);
- dma_cap_zero(mask);
- dma_cap_set(DMA_SLAVE, mask);
- param.prio = PXAD_PRIO_LOWEST;
- param.drcmr = info->drcmr_dat;
- info->dma_chan = dma_request_slave_channel_compat(mask, pxad_filter_fn,
- &param, &pdev->dev,
- "data");
+ info->dma_chan = dma_request_slave_channel(&pdev->dev, "data");
if (!info->dma_chan) {
dev_err(&pdev->dev, "unable to request data dma channel\n");
return -ENODEV;
--
2.11.0


2018-04-02 14:29:59

by Robert Jarzmik

[permalink] [raw]
Subject: [PATCH 07/15] net: smc91x: remove the dmaengine compat need

From: Robert Jarzmik <[email protected]>

As the pxa architecture switched towards the dmaengine slave map, the
old compatibility mechanism to acquire the dma requestor line number and
priority are not needed anymore.

This patch simplifies the dma resource acquisition, using the more
generic function dma_request_slave_channel().

Signed-off-by: Robert Jarzmik <[email protected]>
---
drivers/net/ethernet/smsc/smc91x.c | 12 +-----------
drivers/net/ethernet/smsc/smc91x.h | 1 -
2 files changed, 1 insertion(+), 12 deletions(-)

diff --git a/drivers/net/ethernet/smsc/smc91x.c b/drivers/net/ethernet/smsc/smc91x.c
index 080428762858..4c600f430f6d 100644
--- a/drivers/net/ethernet/smsc/smc91x.c
+++ b/drivers/net/ethernet/smsc/smc91x.c
@@ -2018,18 +2018,8 @@ static int smc_probe(struct net_device *dev, void __iomem *ioaddr,
lp->cfg.flags |= SMC91X_USE_DMA;
# endif
if (lp->cfg.flags & SMC91X_USE_DMA) {
- dma_cap_mask_t mask;
- struct pxad_param param;
-
- dma_cap_zero(mask);
- dma_cap_set(DMA_SLAVE, mask);
- param.prio = PXAD_PRIO_LOWEST;
- param.drcmr = -1UL;
-
lp->dma_chan =
- dma_request_slave_channel_compat(mask, pxad_filter_fn,
- &param, &dev->dev,
- "data");
+ dma_request_slave_channel(lp->device, "data");
}
#endif

diff --git a/drivers/net/ethernet/smsc/smc91x.h b/drivers/net/ethernet/smsc/smc91x.h
index 08b17adf0a65..e849b6c2fa60 100644
--- a/drivers/net/ethernet/smsc/smc91x.h
+++ b/drivers/net/ethernet/smsc/smc91x.h
@@ -327,7 +327,6 @@ struct smc_local {
* as RX which can overrun memory and lose packets.
*/
#include <linux/dma-mapping.h>
-#include <linux/dma/pxa-dma.h>

#ifdef SMC_insl
#undef SMC_insl
--
2.11.0


2018-04-02 14:30:19

by Robert Jarzmik

[permalink] [raw]
Subject: [PATCH 13/15] ARM: pxa: remove the DMA IO resources

As the last driver using the former mechanism to acquire the DMA
requestor line has be converted to the dma_slave_map, remove all these
resources from the PXA devices.

Signed-off-by: Robert Jarzmik <[email protected]>
---
arch/arm/mach-pxa/devices.c | 136 --------------------------------------------
1 file changed, 136 deletions(-)

diff --git a/arch/arm/mach-pxa/devices.c b/arch/arm/mach-pxa/devices.c
index da67ebe9a7d5..c0b3c90fd67f 100644
--- a/arch/arm/mach-pxa/devices.c
+++ b/arch/arm/mach-pxa/devices.c
@@ -61,16 +61,6 @@ static struct resource pxamci_resources[] = {
.end = IRQ_MMC,
.flags = IORESOURCE_IRQ,
},
- [2] = {
- .start = 21,
- .end = 21,
- .flags = IORESOURCE_DMA,
- },
- [3] = {
- .start = 22,
- .end = 22,
- .flags = IORESOURCE_DMA,
- },
};

static u64 pxamci_dmamask = 0xffffffffUL;
@@ -408,16 +398,6 @@ static struct resource pxa_ir_resources[] = {
.end = 0x40700023,
.flags = IORESOURCE_MEM,
},
- [5] = {
- .start = 17,
- .end = 17,
- .flags = IORESOURCE_DMA,
- },
- [6] = {
- .start = 18,
- .end = 18,
- .flags = IORESOURCE_DMA,
- },
};

struct platform_device pxa_device_ficp = {
@@ -546,18 +526,6 @@ static struct resource pxa25x_resource_ssp[] = {
.end = IRQ_SSP,
.flags = IORESOURCE_IRQ,
},
- [2] = {
- /* DRCMR for RX */
- .start = 13,
- .end = 13,
- .flags = IORESOURCE_DMA,
- },
- [3] = {
- /* DRCMR for TX */
- .start = 14,
- .end = 14,
- .flags = IORESOURCE_DMA,
- },
};

struct platform_device pxa25x_device_ssp = {
@@ -584,18 +552,6 @@ static struct resource pxa25x_resource_nssp[] = {
.end = IRQ_NSSP,
.flags = IORESOURCE_IRQ,
},
- [2] = {
- /* DRCMR for RX */
- .start = 15,
- .end = 15,
- .flags = IORESOURCE_DMA,
- },
- [3] = {
- /* DRCMR for TX */
- .start = 16,
- .end = 16,
- .flags = IORESOURCE_DMA,
- },
};

struct platform_device pxa25x_device_nssp = {
@@ -622,18 +578,6 @@ static struct resource pxa25x_resource_assp[] = {
.end = IRQ_ASSP,
.flags = IORESOURCE_IRQ,
},
- [2] = {
- /* DRCMR for RX */
- .start = 23,
- .end = 23,
- .flags = IORESOURCE_DMA,
- },
- [3] = {
- /* DRCMR for TX */
- .start = 24,
- .end = 24,
- .flags = IORESOURCE_DMA,
- },
};

struct platform_device pxa25x_device_assp = {
@@ -752,18 +696,6 @@ static struct resource pxa27x_resource_ssp1[] = {
.end = IRQ_SSP,
.flags = IORESOURCE_IRQ,
},
- [2] = {
- /* DRCMR for RX */
- .start = 13,
- .end = 13,
- .flags = IORESOURCE_DMA,
- },
- [3] = {
- /* DRCMR for TX */
- .start = 14,
- .end = 14,
- .flags = IORESOURCE_DMA,
- },
};

struct platform_device pxa27x_device_ssp1 = {
@@ -790,18 +722,6 @@ static struct resource pxa27x_resource_ssp2[] = {
.end = IRQ_SSP2,
.flags = IORESOURCE_IRQ,
},
- [2] = {
- /* DRCMR for RX */
- .start = 15,
- .end = 15,
- .flags = IORESOURCE_DMA,
- },
- [3] = {
- /* DRCMR for TX */
- .start = 16,
- .end = 16,
- .flags = IORESOURCE_DMA,
- },
};

struct platform_device pxa27x_device_ssp2 = {
@@ -828,18 +748,6 @@ static struct resource pxa27x_resource_ssp3[] = {
.end = IRQ_SSP3,
.flags = IORESOURCE_IRQ,
},
- [2] = {
- /* DRCMR for RX */
- .start = 66,
- .end = 66,
- .flags = IORESOURCE_DMA,
- },
- [3] = {
- /* DRCMR for TX */
- .start = 67,
- .end = 67,
- .flags = IORESOURCE_DMA,
- },
};

struct platform_device pxa27x_device_ssp3 = {
@@ -896,16 +804,6 @@ static struct resource pxa3xx_resources_mci2[] = {
.end = IRQ_MMC2,
.flags = IORESOURCE_IRQ,
},
- [2] = {
- .start = 93,
- .end = 93,
- .flags = IORESOURCE_DMA,
- },
- [3] = {
- .start = 94,
- .end = 94,
- .flags = IORESOURCE_DMA,
- },
};

struct platform_device pxa3xx_device_mci2 = {
@@ -935,16 +833,6 @@ static struct resource pxa3xx_resources_mci3[] = {
.end = IRQ_MMC3,
.flags = IORESOURCE_IRQ,
},
- [2] = {
- .start = 100,
- .end = 100,
- .flags = IORESOURCE_DMA,
- },
- [3] = {
- .start = 101,
- .end = 101,
- .flags = IORESOURCE_DMA,
- },
};

struct platform_device pxa3xx_device_mci3 = {
@@ -1022,18 +910,6 @@ static struct resource pxa3xx_resources_nand[] = {
.end = IRQ_NAND,
.flags = IORESOURCE_IRQ,
},
- [2] = {
- /* DRCMR for Data DMA */
- .start = 97,
- .end = 97,
- .flags = IORESOURCE_DMA,
- },
- [3] = {
- /* DRCMR for Command DMA */
- .start = 99,
- .end = 99,
- .flags = IORESOURCE_DMA,
- },
};

static u64 pxa3xx_nand_dma_mask = DMA_BIT_MASK(32);
@@ -1067,18 +943,6 @@ static struct resource pxa3xx_resource_ssp4[] = {
.end = IRQ_SSP4,
.flags = IORESOURCE_IRQ,
},
- [2] = {
- /* DRCMR for RX */
- .start = 2,
- .end = 2,
- .flags = IORESOURCE_DMA,
- },
- [3] = {
- /* DRCMR for TX */
- .start = 3,
- .end = 3,
- .flags = IORESOURCE_DMA,
- },
};

/*
--
2.11.0


2018-04-02 14:30:57

by Robert Jarzmik

[permalink] [raw]
Subject: [PATCH 14/15] ARM: pxa: change SSP devices allocation

In order to prepare for the dma_slave_map change for SSP DMA channels
allocation, the SSP platform devices will now include a platform data
structure which in turn selects which dma channel has to be used for
data transfers, especially the PCM ones.

Signed-off-by: Robert Jarzmik <[email protected]>
---
arch/arm/mach-pxa/devices.c | 78 +++++++++++++++++++++++++++++-----
arch/arm/mach-pxa/devices.h | 14 ++----
arch/arm/mach-pxa/include/mach/audio.h | 12 ++++++
arch/arm/mach-pxa/pxa25x.c | 4 +-
arch/arm/mach-pxa/pxa27x.c | 4 +-
arch/arm/mach-pxa/pxa3xx.c | 5 +--
6 files changed, 86 insertions(+), 31 deletions(-)

diff --git a/arch/arm/mach-pxa/devices.c b/arch/arm/mach-pxa/devices.c
index c0b3c90fd67f..955d255dc4f4 100644
--- a/arch/arm/mach-pxa/devices.c
+++ b/arch/arm/mach-pxa/devices.c
@@ -481,6 +481,17 @@ void __init pxa_set_ac97_info(pxa2xx_audio_ops_t *ops)
pxa_register_device(&pxa_device_ac97, ops);
}

+static struct pxa_ssp_info pxa_ssp_infos[] = {
+ { .dma_chan_rx_name = "ssp1_rx", .dma_chan_tx_name = "ssp1_tx", },
+ { .dma_chan_rx_name = "ssp1_rx", .dma_chan_tx_name = "ssp1_tx", },
+ { .dma_chan_rx_name = "ssp2_rx", .dma_chan_tx_name = "ssp2_tx", },
+ { .dma_chan_rx_name = "ssp2_rx", .dma_chan_tx_name = "ssp2_tx", },
+ { .dma_chan_rx_name = "ssp3_rx", .dma_chan_tx_name = "ssp3_tx", },
+ { .dma_chan_rx_name = "ssp3_rx", .dma_chan_tx_name = "ssp3_tx", },
+ { .dma_chan_rx_name = "ssp4_rx", .dma_chan_tx_name = "ssp4_tx", },
+ { .dma_chan_rx_name = "ssp4_rx", .dma_chan_tx_name = "ssp4_tx", },
+};
+
#ifdef CONFIG_PXA25x

static struct resource pxa25x_resource_pwm0[] = {
@@ -528,7 +539,7 @@ static struct resource pxa25x_resource_ssp[] = {
},
};

-struct platform_device pxa25x_device_ssp = {
+static struct platform_device pxa25x_device_ssp = {
.name = "pxa25x-ssp",
.id = 0,
.dev = {
@@ -554,7 +565,7 @@ static struct resource pxa25x_resource_nssp[] = {
},
};

-struct platform_device pxa25x_device_nssp = {
+static struct platform_device pxa25x_device_nssp = {
.name = "pxa25x-nssp",
.id = 1,
.dev = {
@@ -580,7 +591,7 @@ static struct resource pxa25x_resource_assp[] = {
},
};

-struct platform_device pxa25x_device_assp = {
+static struct platform_device pxa25x_device_assp = {
/* ASSP is basically equivalent to NSSP */
.name = "pxa25x-nssp",
.id = 2,
@@ -591,6 +602,22 @@ struct platform_device pxa25x_device_assp = {
.resource = pxa25x_resource_assp,
.num_resources = ARRAY_SIZE(pxa25x_resource_assp),
};
+
+static struct platform_device *pxa25x_device_ssps[] = {
+ &pxa25x_device_ssp,
+ &pxa25x_device_nssp,
+ &pxa25x_device_assp,
+};
+
+void __init pxa25x_set_ssp_info(void)
+{
+ int ssp;
+
+ for (ssp = 0; ssp < ARRAY_SIZE(pxa25x_device_ssps); ssp++)
+ pxa_register_device(pxa25x_device_ssps[ssp],
+ &pxa_ssp_infos[ssp]);
+}
+
#endif /* CONFIG_PXA25x */

#if defined(CONFIG_PXA27x) || defined(CONFIG_PXA3xx)
@@ -698,7 +725,7 @@ static struct resource pxa27x_resource_ssp1[] = {
},
};

-struct platform_device pxa27x_device_ssp1 = {
+static struct platform_device pxa27x_device_ssp1 = {
.name = "pxa27x-ssp",
.id = 0,
.dev = {
@@ -724,7 +751,7 @@ static struct resource pxa27x_resource_ssp2[] = {
},
};

-struct platform_device pxa27x_device_ssp2 = {
+static struct platform_device pxa27x_device_ssp2 = {
.name = "pxa27x-ssp",
.id = 1,
.dev = {
@@ -750,7 +777,7 @@ static struct resource pxa27x_resource_ssp3[] = {
},
};

-struct platform_device pxa27x_device_ssp3 = {
+static struct platform_device pxa27x_device_ssp3 = {
.name = "pxa27x-ssp",
.id = 2,
.dev = {
@@ -761,6 +788,21 @@ struct platform_device pxa27x_device_ssp3 = {
.num_resources = ARRAY_SIZE(pxa27x_resource_ssp3),
};

+static struct platform_device *pxa27x_device_ssps[] = {
+ &pxa27x_device_ssp1,
+ &pxa27x_device_ssp2,
+ &pxa27x_device_ssp3,
+};
+
+void __init pxa27x_set_ssp_info(void)
+{
+ int ssp;
+
+ for (ssp = 0; ssp < ARRAY_SIZE(pxa27x_device_ssps); ssp++)
+ pxa_register_device(pxa27x_device_ssps[ssp],
+ &pxa_ssp_infos[ssp]);
+}
+
static struct resource pxa27x_resource_pwm0[] = {
[0] = {
.start = 0x40b00000,
@@ -951,7 +993,7 @@ static struct resource pxa3xx_resource_ssp4[] = {
* make the driver set the correct internal type, hence we provide specific
* platform_devices for each of them.
*/
-struct platform_device pxa3xx_device_ssp1 = {
+static struct platform_device pxa3xx_device_ssp1 = {
.name = "pxa3xx-ssp",
.id = 0,
.dev = {
@@ -962,7 +1004,7 @@ struct platform_device pxa3xx_device_ssp1 = {
.num_resources = ARRAY_SIZE(pxa27x_resource_ssp1),
};

-struct platform_device pxa3xx_device_ssp2 = {
+static struct platform_device pxa3xx_device_ssp2 = {
.name = "pxa3xx-ssp",
.id = 1,
.dev = {
@@ -973,7 +1015,7 @@ struct platform_device pxa3xx_device_ssp2 = {
.num_resources = ARRAY_SIZE(pxa27x_resource_ssp2),
};

-struct platform_device pxa3xx_device_ssp3 = {
+static struct platform_device pxa3xx_device_ssp3 = {
.name = "pxa3xx-ssp",
.id = 2,
.dev = {
@@ -984,7 +1026,7 @@ struct platform_device pxa3xx_device_ssp3 = {
.num_resources = ARRAY_SIZE(pxa27x_resource_ssp3),
};

-struct platform_device pxa3xx_device_ssp4 = {
+static struct platform_device pxa3xx_device_ssp4 = {
.name = "pxa3xx-ssp",
.id = 3,
.dev = {
@@ -994,6 +1036,22 @@ struct platform_device pxa3xx_device_ssp4 = {
.resource = pxa3xx_resource_ssp4,
.num_resources = ARRAY_SIZE(pxa3xx_resource_ssp4),
};
+
+static struct platform_device *pxa3xx_device_ssps[] = {
+ &pxa3xx_device_ssp1,
+ &pxa3xx_device_ssp2,
+ &pxa3xx_device_ssp3,
+ &pxa3xx_device_ssp4,
+};
+
+void __init pxa3xx_set_ssp_info(void)
+{
+ int ssp;
+
+ for (ssp = 0; ssp < ARRAY_SIZE(pxa3xx_device_ssps); ssp++)
+ pxa_register_device(pxa3xx_device_ssps[ssp],
+ &pxa_ssp_infos[ssp]);
+}
#endif /* CONFIG_PXA3xx */

struct resource pxa_resource_gpio[] = {
diff --git a/arch/arm/mach-pxa/devices.h b/arch/arm/mach-pxa/devices.h
index 11263f7c455b..5909805e7d84 100644
--- a/arch/arm/mach-pxa/devices.h
+++ b/arch/arm/mach-pxa/devices.h
@@ -22,17 +22,6 @@ extern struct platform_device pxa27x_device_i2c_power;
extern struct platform_device pxa27x_device_ohci;
extern struct platform_device pxa27x_device_keypad;

-extern struct platform_device pxa25x_device_ssp;
-extern struct platform_device pxa25x_device_nssp;
-extern struct platform_device pxa25x_device_assp;
-extern struct platform_device pxa27x_device_ssp1;
-extern struct platform_device pxa27x_device_ssp2;
-extern struct platform_device pxa27x_device_ssp3;
-extern struct platform_device pxa3xx_device_ssp1;
-extern struct platform_device pxa3xx_device_ssp2;
-extern struct platform_device pxa3xx_device_ssp3;
-extern struct platform_device pxa3xx_device_ssp4;
-
extern struct platform_device pxa25x_device_pwm0;
extern struct platform_device pxa25x_device_pwm1;
extern struct platform_device pxa27x_device_pwm0;
@@ -65,3 +54,6 @@ extern void pxa27x_set_i2c_power_info(struct i2c_pxa_platform_data *info);
#ifdef CONFIG_PXA3xx
extern void pxa3xx_set_i2c_power_info(struct i2c_pxa_platform_data *info);
#endif
+void pxa25x_set_ssp_info(void);
+void pxa27x_set_ssp_info(void);
+void pxa3xx_set_ssp_info(void);
diff --git a/arch/arm/mach-pxa/include/mach/audio.h b/arch/arm/mach-pxa/include/mach/audio.h
index 7beebf7297b5..f1f6bc7673a1 100644
--- a/arch/arm/mach-pxa/include/mach/audio.h
+++ b/arch/arm/mach-pxa/include/mach/audio.h
@@ -28,4 +28,16 @@ typedef struct {

extern void pxa_set_ac97_info(pxa2xx_audio_ops_t *ops);

+/*
+ * struct pxa_ssp_info - platform data for SSP devices
+ * @dma_chan_rx_name: name of the receive dma channel to query, see
+ * pxa_slave_map
+ * @dma_chan_tx_name: name of the transmit dma channel to query, see
+ * pxa_slave_map
+ */
+struct pxa_ssp_info {
+ const char *dma_chan_rx_name;
+ const char *dma_chan_tx_name;
+};
+
#endif
diff --git a/arch/arm/mach-pxa/pxa25x.c b/arch/arm/mach-pxa/pxa25x.c
index ba431fad5c47..74779afbf200 100644
--- a/arch/arm/mach-pxa/pxa25x.c
+++ b/arch/arm/mach-pxa/pxa25x.c
@@ -193,9 +193,6 @@ static struct platform_device *pxa25x_devices[] __initdata = {
&pxa_device_pmu,
&pxa_device_i2s,
&sa1100_device_rtc,
- &pxa25x_device_ssp,
- &pxa25x_device_nssp,
- &pxa25x_device_assp,
&pxa25x_device_pwm0,
&pxa25x_device_pwm1,
&pxa_device_asoc_platform,
@@ -219,6 +216,7 @@ static int __init pxa25x_init(void)
pxa_register_device(&pxa25x_device_gpio, &pxa25x_gpio_info);
ret = platform_add_devices(pxa25x_devices,
ARRAY_SIZE(pxa25x_devices));
+ pxa25x_set_ssp_info();
}
}

diff --git a/arch/arm/mach-pxa/pxa27x.c b/arch/arm/mach-pxa/pxa27x.c
index 0c06f383ad52..f3896d164fd3 100644
--- a/arch/arm/mach-pxa/pxa27x.c
+++ b/arch/arm/mach-pxa/pxa27x.c
@@ -290,9 +290,6 @@ static struct platform_device *devices[] __initdata = {
&pxa_device_asoc_ssp3,
&pxa_device_asoc_platform,
&pxa_device_rtc,
- &pxa27x_device_ssp1,
- &pxa27x_device_ssp2,
- &pxa27x_device_ssp3,
&pxa27x_device_pwm0,
&pxa27x_device_pwm1,
};
@@ -313,6 +310,7 @@ static int __init pxa27x_init(void)
if (!of_have_populated_dt()) {
pxa_register_device(&pxa27x_device_gpio,
&pxa27x_gpio_info);
+ pxa27x_set_ssp_info();
pxa2xx_set_dmac_info(32, 75);
ret = platform_add_devices(devices,
ARRAY_SIZE(devices));
diff --git a/arch/arm/mach-pxa/pxa3xx.c b/arch/arm/mach-pxa/pxa3xx.c
index 4b8a0df8ea57..2a5044dd463e 100644
--- a/arch/arm/mach-pxa/pxa3xx.c
+++ b/arch/arm/mach-pxa/pxa3xx.c
@@ -413,10 +413,6 @@ static struct platform_device *devices[] __initdata = {
&pxa_device_asoc_ssp4,
&pxa_device_asoc_platform,
&pxa_device_rtc,
- &pxa3xx_device_ssp1,
- &pxa3xx_device_ssp2,
- &pxa3xx_device_ssp3,
- &pxa3xx_device_ssp4,
&pxa27x_device_pwm0,
&pxa27x_device_pwm1,
};
@@ -456,6 +452,7 @@ static int __init pxa3xx_init(void)
ret = platform_add_devices(devices, ARRAY_SIZE(devices));
if (ret)
return ret;
+ pxa3xx_set_ssp_info();
if (cpu_is_pxa300() || cpu_is_pxa310() || cpu_is_pxa320()) {
platform_device_add_data(&pxa3xx_device_gpio,
&pxa3xx_gpio_pdata,
--
2.11.0


2018-04-02 14:31:06

by Robert Jarzmik

[permalink] [raw]
Subject: [PATCH 06/15] net: smc911x: remove the dmaengine compat need

From: Robert Jarzmik <[email protected]>

As the pxa architecture switched towards the dmaengine slave map, the
old compatibility mechanism to acquire the dma requestor line number and
priority are not needed anymore.

This patch simplifies the dma resource acquisition, using the more
generic function dma_request_slave_channel().

Signed-off-by: Robert Jarzmik <[email protected]>
---
drivers/net/ethernet/smsc/smc911x.c | 16 ++--------------
1 file changed, 2 insertions(+), 14 deletions(-)

diff --git a/drivers/net/ethernet/smsc/smc911x.c b/drivers/net/ethernet/smsc/smc911x.c
index 05157442a980..4c3713bd5caa 100644
--- a/drivers/net/ethernet/smsc/smc911x.c
+++ b/drivers/net/ethernet/smsc/smc911x.c
@@ -74,7 +74,6 @@ static const char version[] =
#include <linux/skbuff.h>

#include <linux/dmaengine.h>
-#include <linux/dma/pxa-dma.h>

#include <asm/io.h>

@@ -1794,8 +1793,6 @@ static int smc911x_probe(struct net_device *dev)
unsigned long irq_flags;
#ifdef SMC_USE_DMA
struct dma_slave_config config;
- dma_cap_mask_t mask;
- struct pxad_param param;
#endif

DBG(SMC_DEBUG_FUNC, dev, "--> %s\n", __func__);
@@ -1969,17 +1966,8 @@ static int smc911x_probe(struct net_device *dev)

#ifdef SMC_USE_DMA

- dma_cap_zero(mask);
- dma_cap_set(DMA_SLAVE, mask);
- param.prio = PXAD_PRIO_LOWEST;
- param.drcmr = -1UL;
-
- lp->rxdma =
- dma_request_slave_channel_compat(mask, pxad_filter_fn,
- &param, &dev->dev, "rx");
- lp->txdma =
- dma_request_slave_channel_compat(mask, pxad_filter_fn,
- &param, &dev->dev, "tx");
+ lp->rxdma = dma_request_slave_channel(&dev->dev, "rx");
+ lp->txdma = dma_request_slave_channel(&dev->dev, "tx");
lp->rxdma_active = 0;
lp->txdma_active = 0;

--
2.11.0


2018-04-02 14:31:12

by Robert Jarzmik

[permalink] [raw]
Subject: [PATCH 15/15] ARM: pxa: change SSP DMA channels allocation

Now the dma_slave_map is available for PXA architecture, switch the SSP
device to it.

This specifically means that :
- for platform data based machines, the DMA requestor channels are
extracted from platform data and passed further to the SSP user,
ie. usually the pxa-pcm-audio driver

- for device tree platforms, the dma node should be hooked into the
pxa-pcm-audio node.

Signed-off-by: Robert Jarzmik <[email protected]>
---
arch/arm/plat-pxa/ssp.c | 50 +++++-----------------------------------------
include/linux/pxa2xx_ssp.h | 4 ++--
sound/soc/pxa/pxa-ssp.c | 5 ++---
3 files changed, 9 insertions(+), 50 deletions(-)

diff --git a/arch/arm/plat-pxa/ssp.c b/arch/arm/plat-pxa/ssp.c
index ba13f793fbce..3457f01e3340 100644
--- a/arch/arm/plat-pxa/ssp.c
+++ b/arch/arm/plat-pxa/ssp.c
@@ -16,6 +16,7 @@
* Author: Liam Girdwood <[email protected]>
*/

+#include <mach/audio.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/sched.h>
@@ -116,6 +117,7 @@ static int pxa_ssp_probe(struct platform_device *pdev)
struct resource *res;
struct ssp_device *ssp;
struct device *dev = &pdev->dev;
+ struct pxa_ssp_info *info = dev_get_platdata(dev);

ssp = devm_kzalloc(dev, sizeof(struct ssp_device), GFP_KERNEL);
if (ssp == NULL)
@@ -127,51 +129,9 @@ static int pxa_ssp_probe(struct platform_device *pdev)
if (IS_ERR(ssp->clk))
return PTR_ERR(ssp->clk);

- if (dev->of_node) {
- struct of_phandle_args dma_spec;
- struct device_node *np = dev->of_node;
- int ret;
-
- /*
- * FIXME: we should allocate the DMA channel from this
- * context and pass the channel down to the ssp users.
- * For now, we lookup the rx and tx indices manually
- */
-
- /* rx */
- ret = of_parse_phandle_with_args(np, "dmas", "#dma-cells",
- 0, &dma_spec);
-
- if (ret) {
- dev_err(dev, "Can't parse dmas property\n");
- return -ENODEV;
- }
- ssp->drcmr_rx = dma_spec.args[0];
- of_node_put(dma_spec.np);
-
- /* tx */
- ret = of_parse_phandle_with_args(np, "dmas", "#dma-cells",
- 1, &dma_spec);
- if (ret) {
- dev_err(dev, "Can't parse dmas property\n");
- return -ENODEV;
- }
- ssp->drcmr_tx = dma_spec.args[0];
- of_node_put(dma_spec.np);
- } else {
- res = platform_get_resource(pdev, IORESOURCE_DMA, 0);
- if (res == NULL) {
- dev_err(dev, "no SSP RX DRCMR defined\n");
- return -ENODEV;
- }
- ssp->drcmr_rx = res->start;
-
- res = platform_get_resource(pdev, IORESOURCE_DMA, 1);
- if (res == NULL) {
- dev_err(dev, "no SSP TX DRCMR defined\n");
- return -ENODEV;
- }
- ssp->drcmr_tx = res->start;
+ if (!dev->of_node && info) {
+ ssp->dma_chan_rx = info->dma_chan_rx_name;
+ ssp->dma_chan_tx = info->dma_chan_tx_name;
}

res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
diff --git a/include/linux/pxa2xx_ssp.h b/include/linux/pxa2xx_ssp.h
index 8461b18e4608..99c99d397e4d 100644
--- a/include/linux/pxa2xx_ssp.h
+++ b/include/linux/pxa2xx_ssp.h
@@ -212,9 +212,9 @@ struct ssp_device {
int type;
int use_count;
int irq;
- int drcmr_rx;
- int drcmr_tx;

+ const char *dma_chan_rx;
+ const char *dma_chan_tx;
struct device_node *of_node;
};

diff --git a/sound/soc/pxa/pxa-ssp.c b/sound/soc/pxa/pxa-ssp.c
index 0291c7cb64eb..a0189b88f1d2 100644
--- a/sound/soc/pxa/pxa-ssp.c
+++ b/sound/soc/pxa/pxa-ssp.c
@@ -104,9 +104,8 @@ static int pxa_ssp_startup(struct snd_pcm_substream *substream,
dma = kzalloc(sizeof(struct snd_dmaengine_dai_dma_data), GFP_KERNEL);
if (!dma)
return -ENOMEM;
-
- dma->filter_data = substream->stream == SNDRV_PCM_STREAM_PLAYBACK ?
- &ssp->drcmr_tx : &ssp->drcmr_rx;
+ dma->chan_name = substream->stream == SNDRV_PCM_STREAM_PLAYBACK ?
+ ssp->dma_chan_tx : ssp->dma_chan_rx;

snd_soc_dai_set_dma_data(cpu_dai, substream, dma);

--
2.11.0


2018-04-02 14:31:58

by Robert Jarzmik

[permalink] [raw]
Subject: [PATCH 12/15] dmaengine: pxa: make the filter function internal

As the pxa architecture and all its related drivers do not rely anymore
on the filter function, thanks to the slave map conversion, make
pxad_filter_fn() static, and remove it from the global namespace.

Signed-off-by: Robert Jarzmik <[email protected]>
---
drivers/dma/pxa_dma.c | 5 ++---
include/linux/dma/pxa-dma.h | 11 -----------
2 files changed, 2 insertions(+), 14 deletions(-)

diff --git a/drivers/dma/pxa_dma.c b/drivers/dma/pxa_dma.c
index 9505334f9c6e..a332ad1d7dfb 100644
--- a/drivers/dma/pxa_dma.c
+++ b/drivers/dma/pxa_dma.c
@@ -179,7 +179,7 @@ static unsigned int pxad_drcmr(unsigned int line)
return 0x1000 + line * 4;
}

-bool pxad_filter_fn(struct dma_chan *chan, void *param);
+static bool pxad_filter_fn(struct dma_chan *chan, void *param);

/*
* Debug fs
@@ -1496,7 +1496,7 @@ static struct platform_driver pxad_driver = {
.remove = pxad_remove,
};

-bool pxad_filter_fn(struct dma_chan *chan, void *param)
+static bool pxad_filter_fn(struct dma_chan *chan, void *param)
{
struct pxad_chan *c = to_pxad_chan(chan);
struct pxad_param *p = param;
@@ -1509,7 +1509,6 @@ bool pxad_filter_fn(struct dma_chan *chan, void *param)

return true;
}
-EXPORT_SYMBOL_GPL(pxad_filter_fn);

module_platform_driver(pxad_driver);

diff --git a/include/linux/dma/pxa-dma.h b/include/linux/dma/pxa-dma.h
index 9fc594f69eff..fceb5df07097 100644
--- a/include/linux/dma/pxa-dma.h
+++ b/include/linux/dma/pxa-dma.h
@@ -23,15 +23,4 @@ struct pxad_param {
enum pxad_chan_prio prio;
};

-struct dma_chan;
-
-#ifdef CONFIG_PXA_DMA
-bool pxad_filter_fn(struct dma_chan *chan, void *param);
-#else
-static inline bool pxad_filter_fn(struct dma_chan *chan, void *param)
-{
- return false;
-}
-#endif
-
#endif /* _PXA_DMA_H_ */
--
2.11.0


2018-04-02 14:32:15

by Robert Jarzmik

[permalink] [raw]
Subject: [PATCH 10/15] ata: pata_pxa: remove the dmaengine compat need

As the pxa architecture switched towards the dmaengine slave map, the
old compatibility mechanism to acquire the dma requestor line number and
priority are not needed anymore.

This patch simplifies the dma resource acquisition, using the more
generic function dma_request_slave_channel().

Signed-off-by: Robert Jarzmik <[email protected]>
---
drivers/ata/pata_pxa.c | 10 +---------
1 file changed, 1 insertion(+), 9 deletions(-)

diff --git a/drivers/ata/pata_pxa.c b/drivers/ata/pata_pxa.c
index f6c46e9a4dc0..e8b6a2e464c9 100644
--- a/drivers/ata/pata_pxa.c
+++ b/drivers/ata/pata_pxa.c
@@ -25,7 +25,6 @@
#include <linux/libata.h>
#include <linux/platform_device.h>
#include <linux/dmaengine.h>
-#include <linux/dma/pxa-dma.h>
#include <linux/gpio.h>
#include <linux/slab.h>
#include <linux/completion.h>
@@ -180,8 +179,6 @@ static int pxa_ata_probe(struct platform_device *pdev)
struct resource *irq_res;
struct pata_pxa_pdata *pdata = dev_get_platdata(&pdev->dev);
struct dma_slave_config config;
- dma_cap_mask_t mask;
- struct pxad_param param;
int ret = 0;

/*
@@ -278,10 +275,6 @@ static int pxa_ata_probe(struct platform_device *pdev)

ap->private_data = data;

- dma_cap_zero(mask);
- dma_cap_set(DMA_SLAVE, mask);
- param.prio = PXAD_PRIO_LOWEST;
- param.drcmr = pdata->dma_dreq;
memset(&config, 0, sizeof(config));
config.src_addr_width = DMA_SLAVE_BUSWIDTH_2_BYTES;
config.dst_addr_width = DMA_SLAVE_BUSWIDTH_2_BYTES;
@@ -294,8 +287,7 @@ static int pxa_ata_probe(struct platform_device *pdev)
* Request the DMA channel
*/
data->dma_chan =
- dma_request_slave_channel_compat(mask, pxad_filter_fn,
- &param, &pdev->dev, "data");
+ dma_request_slave_channel(&pdev->dev, "data");
if (!data->dma_chan)
return -EBUSY;
ret = dmaengine_slave_config(data->dma_chan, &config);
--
2.11.0


2018-04-02 14:32:38

by Robert Jarzmik

[permalink] [raw]
Subject: [PATCH 11/15] dmaengine: pxa: document pxad_param

Add some documentation for the pxad_param structure, and describe the
contract behind the minimal required priority of a DMA channel.

Signed-off-by: Robert Jarzmik <[email protected]>
---
include/linux/dma/pxa-dma.h | 9 +++++++++
1 file changed, 9 insertions(+)

diff --git a/include/linux/dma/pxa-dma.h b/include/linux/dma/pxa-dma.h
index e56ec7af4fd7..9fc594f69eff 100644
--- a/include/linux/dma/pxa-dma.h
+++ b/include/linux/dma/pxa-dma.h
@@ -9,6 +9,15 @@ enum pxad_chan_prio {
PXAD_PRIO_LOWEST,
};

+/**
+ * struct pxad_param - dma channel request parameters
+ * @drcmr: requestor line number
+ * @prio: minimal mandatory priority of the channel
+ *
+ * If a requested channel is granted, its priority will be at least @prio,
+ * ie. if PXAD_PRIO_LOW is required, the requested channel will be either
+ * PXAD_PRIO_LOW, PXAD_PRIO_NORMAL or PXAD_PRIO_HIGHEST.
+ */
struct pxad_param {
unsigned int drcmr;
enum pxad_chan_prio prio;
--
2.11.0


2018-04-02 14:33:04

by Robert Jarzmik

[permalink] [raw]
Subject: [PATCH 09/15] net: irda: pxaficp_ir: remove the dmaengine compat need

As the pxa architecture switched towards the dmaengine slave map, the
old compatibility mechanism to acquire the dma requestor line number and
priority are not needed anymore.

This patch simplifies the dma resource acquisition, using the more
generic function dma_request_slave_channel().

Signed-off-by: Robert Jarzmik <[email protected]>
---
drivers/staging/irda/drivers/pxaficp_ir.c | 14 ++------------
1 file changed, 2 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/irda/drivers/pxaficp_ir.c b/drivers/staging/irda/drivers/pxaficp_ir.c
index 2ea00a6531f9..9dd6e21dc11e 100644
--- a/drivers/staging/irda/drivers/pxaficp_ir.c
+++ b/drivers/staging/irda/drivers/pxaficp_ir.c
@@ -20,7 +20,6 @@
#include <linux/clk.h>
#include <linux/dmaengine.h>
#include <linux/dma-mapping.h>
-#include <linux/dma/pxa-dma.h>
#include <linux/gpio.h>
#include <linux/slab.h>
#include <linux/sched/clock.h>
@@ -735,9 +734,7 @@ static void pxa_irda_shutdown(struct pxa_irda *si)
static int pxa_irda_start(struct net_device *dev)
{
struct pxa_irda *si = netdev_priv(dev);
- dma_cap_mask_t mask;
struct dma_slave_config config;
- struct pxad_param param;
int err;

si->speed = 9600;
@@ -757,9 +754,6 @@ static int pxa_irda_start(struct net_device *dev)
disable_irq(si->icp_irq);

err = -EBUSY;
- dma_cap_zero(mask);
- dma_cap_set(DMA_SLAVE, mask);
- param.prio = PXAD_PRIO_LOWEST;

memset(&config, 0, sizeof(config));
config.src_addr_width = DMA_SLAVE_BUSWIDTH_1_BYTE;
@@ -769,15 +763,11 @@ static int pxa_irda_start(struct net_device *dev)
config.src_maxburst = 32;
config.dst_maxburst = 32;

- param.drcmr = si->drcmr_rx;
- si->rxdma = dma_request_slave_channel_compat(mask, pxad_filter_fn,
- &param, &dev->dev, "rx");
+ si->rxdma = dma_request_slave_channel(&dev->dev, "rx");
if (!si->rxdma)
goto err_rx_dma;

- param.drcmr = si->drcmr_tx;
- si->txdma = dma_request_slave_channel_compat(mask, pxad_filter_fn,
- &param, &dev->dev, "tx");
+ si->txdma = dma_request_slave_channel(&dev->dev, "tx");
if (!si->txdma)
goto err_tx_dma;

--
2.11.0


2018-04-02 14:33:18

by Robert Jarzmik

[permalink] [raw]
Subject: [PATCH 08/15] ASoC: pxa: remove the dmaengine compat need

As the pxa architecture switched towards the dmaengine slave map, the
old compatibility mechanism to acquire the dma requestor line number and
priority are not needed anymore.

This patch simplifies the dma resource acquisition, using the more
generic function dma_request_slave_channel().

Signed-off-by: Robert Jarzmik <[email protected]>
---
sound/arm/pxa2xx-ac97.c | 14 ++------------
sound/arm/pxa2xx-pcm-lib.c | 6 +++---
sound/soc/pxa/pxa2xx-ac97.c | 32 +++++---------------------------
3 files changed, 10 insertions(+), 42 deletions(-)

diff --git a/sound/arm/pxa2xx-ac97.c b/sound/arm/pxa2xx-ac97.c
index 4bc244c40f80..236a63cdaf9f 100644
--- a/sound/arm/pxa2xx-ac97.c
+++ b/sound/arm/pxa2xx-ac97.c
@@ -63,28 +63,18 @@ static struct snd_ac97_bus_ops pxa2xx_ac97_ops = {
.reset = pxa2xx_ac97_legacy_reset,
};

-static struct pxad_param pxa2xx_ac97_pcm_out_req = {
- .prio = PXAD_PRIO_LOWEST,
- .drcmr = 12,
-};
-
static struct snd_dmaengine_dai_dma_data pxa2xx_ac97_pcm_out = {
.addr = __PREG(PCDR),
.addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES,
+ .chan_name = "pcm_pcm_stereo_out",
.maxburst = 32,
- .filter_data = &pxa2xx_ac97_pcm_out_req,
-};
-
-static struct pxad_param pxa2xx_ac97_pcm_in_req = {
- .prio = PXAD_PRIO_LOWEST,
- .drcmr = 11,
};

static struct snd_dmaengine_dai_dma_data pxa2xx_ac97_pcm_in = {
.addr = __PREG(PCDR),
.addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES,
+ .chan_name = "pcm_pcm_stereo_in",
.maxburst = 32,
- .filter_data = &pxa2xx_ac97_pcm_in_req,
};

static struct snd_pcm *pxa2xx_ac97_pcm;
diff --git a/sound/arm/pxa2xx-pcm-lib.c b/sound/arm/pxa2xx-pcm-lib.c
index e8da3b8ee721..cbfaba60b79a 100644
--- a/sound/arm/pxa2xx-pcm-lib.c
+++ b/sound/arm/pxa2xx-pcm-lib.c
@@ -125,9 +125,9 @@ int __pxa2xx_pcm_open(struct snd_pcm_substream *substream)
if (ret < 0)
return ret;

- return snd_dmaengine_pcm_open_request_chan(substream,
- pxad_filter_fn,
- dma_params->filter_data);
+ return snd_dmaengine_pcm_open(
+ substream, dma_request_slave_channel(rtd->platform->dev,
+ dma_params->chan_name));
}
EXPORT_SYMBOL(__pxa2xx_pcm_open);

diff --git a/sound/soc/pxa/pxa2xx-ac97.c b/sound/soc/pxa/pxa2xx-ac97.c
index 803818aabee9..1b41c0f2a8fb 100644
--- a/sound/soc/pxa/pxa2xx-ac97.c
+++ b/sound/soc/pxa/pxa2xx-ac97.c
@@ -68,61 +68,39 @@ static struct snd_ac97_bus_ops pxa2xx_ac97_ops = {
.reset = pxa2xx_ac97_cold_reset,
};

-static struct pxad_param pxa2xx_ac97_pcm_stereo_in_req = {
- .prio = PXAD_PRIO_LOWEST,
- .drcmr = 11,
-};
-
static struct snd_dmaengine_dai_dma_data pxa2xx_ac97_pcm_stereo_in = {
.addr = __PREG(PCDR),
.addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES,
+ .chan_name = "pcm_pcm_stereo_in",
.maxburst = 32,
- .filter_data = &pxa2xx_ac97_pcm_stereo_in_req,
-};
-
-static struct pxad_param pxa2xx_ac97_pcm_stereo_out_req = {
- .prio = PXAD_PRIO_LOWEST,
- .drcmr = 12,
};

static struct snd_dmaengine_dai_dma_data pxa2xx_ac97_pcm_stereo_out = {
.addr = __PREG(PCDR),
.addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES,
+ .chan_name = "pcm_pcm_stereo_out",
.maxburst = 32,
- .filter_data = &pxa2xx_ac97_pcm_stereo_out_req,
};

-static struct pxad_param pxa2xx_ac97_pcm_aux_mono_out_req = {
- .prio = PXAD_PRIO_LOWEST,
- .drcmr = 10,
-};
static struct snd_dmaengine_dai_dma_data pxa2xx_ac97_pcm_aux_mono_out = {
.addr = __PREG(MODR),
.addr_width = DMA_SLAVE_BUSWIDTH_2_BYTES,
+ .chan_name = "pcm_aux_mono_out",
.maxburst = 16,
- .filter_data = &pxa2xx_ac97_pcm_aux_mono_out_req,
};

-static struct pxad_param pxa2xx_ac97_pcm_aux_mono_in_req = {
- .prio = PXAD_PRIO_LOWEST,
- .drcmr = 9,
-};
static struct snd_dmaengine_dai_dma_data pxa2xx_ac97_pcm_aux_mono_in = {
.addr = __PREG(MODR),
.addr_width = DMA_SLAVE_BUSWIDTH_2_BYTES,
+ .chan_name = "pcm_aux_mono_in",
.maxburst = 16,
- .filter_data = &pxa2xx_ac97_pcm_aux_mono_in_req,
};

-static struct pxad_param pxa2xx_ac97_pcm_aux_mic_mono_req = {
- .prio = PXAD_PRIO_LOWEST,
- .drcmr = 8,
-};
static struct snd_dmaengine_dai_dma_data pxa2xx_ac97_pcm_mic_mono_in = {
.addr = __PREG(MCDR),
.addr_width = DMA_SLAVE_BUSWIDTH_2_BYTES,
+ .chan_name = "pcm_aux_mic_mono",
.maxburst = 16,
- .filter_data = &pxa2xx_ac97_pcm_aux_mic_mono_req,
};

static int pxa2xx_ac97_hifi_startup(struct snd_pcm_substream *substream,
--
2.11.0


2018-04-02 14:33:52

by Robert Jarzmik

[permalink] [raw]
Subject: [PATCH 04/15] media: pxa_camera: remove the dmaengine compat need

From: Robert Jarzmik <[email protected]>

As the pxa architecture switched towards the dmaengine slave map, the
old compatibility mechanism to acquire the dma requestor line number and
priority are not needed anymore.

This patch simplifies the dma resource acquisition, using the more
generic function dma_request_slave_channel().

Signed-off-by: Robert Jarzmik <[email protected]>
---
drivers/media/platform/pxa_camera.c | 22 +++-------------------
1 file changed, 3 insertions(+), 19 deletions(-)

diff --git a/drivers/media/platform/pxa_camera.c b/drivers/media/platform/pxa_camera.c
index c71a00736541..4c82d1880753 100644
--- a/drivers/media/platform/pxa_camera.c
+++ b/drivers/media/platform/pxa_camera.c
@@ -2357,8 +2357,6 @@ static int pxa_camera_probe(struct platform_device *pdev)
.src_maxburst = 8,
.direction = DMA_DEV_TO_MEM,
};
- dma_cap_mask_t mask;
- struct pxad_param params;
char clk_name[V4L2_CLK_NAME_SIZE];
int irq;
int err = 0, i;
@@ -2432,34 +2430,20 @@ static int pxa_camera_probe(struct platform_device *pdev)
pcdev->base = base;

/* request dma */
- dma_cap_zero(mask);
- dma_cap_set(DMA_SLAVE, mask);
- dma_cap_set(DMA_PRIVATE, mask);
-
- params.prio = 0;
- params.drcmr = 68;
- pcdev->dma_chans[0] =
- dma_request_slave_channel_compat(mask, pxad_filter_fn,
- &params, &pdev->dev, "CI_Y");
+ pcdev->dma_chans[0] = dma_request_slave_channel(&pdev->dev, "CI_Y");
if (!pcdev->dma_chans[0]) {
dev_err(&pdev->dev, "Can't request DMA for Y\n");
return -ENODEV;
}

- params.drcmr = 69;
- pcdev->dma_chans[1] =
- dma_request_slave_channel_compat(mask, pxad_filter_fn,
- &params, &pdev->dev, "CI_U");
+ pcdev->dma_chans[1] = dma_request_slave_channel(&pdev->dev, "CI_U");
if (!pcdev->dma_chans[1]) {
dev_err(&pdev->dev, "Can't request DMA for Y\n");
err = -ENODEV;
goto exit_free_dma_y;
}

- params.drcmr = 70;
- pcdev->dma_chans[2] =
- dma_request_slave_channel_compat(mask, pxad_filter_fn,
- &params, &pdev->dev, "CI_V");
+ pcdev->dma_chans[2] = dma_request_slave_channel(&pdev->dev, "CI_V");
if (!pcdev->dma_chans[2]) {
dev_err(&pdev->dev, "Can't request DMA for V\n");
err = -ENODEV;
--
2.11.0


2018-04-02 14:37:30

by Robert Jarzmik

[permalink] [raw]
Subject: [PATCH 02/15] ARM: pxa: add dma slave map

In order to remove the specific knowledge of the dma mapping from PXA
drivers, add a default slave map for pxa architectures.

This is the first step, and once all drivers are converted,
pxad_filter_fn() will be made static, and the DMA resources removed from
device.c.

Signed-off-by: Robert Jarzmik <[email protected]>
Reported-by: Arnd Bergmann <[email protected]>
---
arch/arm/mach-pxa/devices.c | 55 +++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 55 insertions(+)

diff --git a/arch/arm/mach-pxa/devices.c b/arch/arm/mach-pxa/devices.c
index d7c9a8476d57..da67ebe9a7d5 100644
--- a/arch/arm/mach-pxa/devices.c
+++ b/arch/arm/mach-pxa/devices.c
@@ -4,6 +4,8 @@
#include <linux/init.h>
#include <linux/platform_device.h>
#include <linux/dma-mapping.h>
+#include <linux/dma/pxa-dma.h>
+#include <linux/dmaengine.h>
#include <linux/spi/pxa2xx_spi.h>
#include <linux/platform_data/i2c-pxa.h>

@@ -1202,9 +1204,62 @@ void __init pxa2xx_set_spi_info(unsigned id, struct pxa2xx_spi_master *info)
platform_device_add(pd);
}

+#define PDMA_FILTER_PARAM(_prio, _requestor) (&(struct pxad_param) { \
+ .prio = PXAD_PRIO_##_prio, .drcmr = _requestor })
+
+static const struct dma_slave_map pxa_slave_map[] = {
+ /* PXA25x, PXA27x and PXA3xx common entries */
+ { "pxa-pcm-audio", "ac97_mic_mono", PDMA_FILTER_PARAM(LOWEST, 8) },
+ { "pxa-pcm-audio", "ac97_aux_mono_in", PDMA_FILTER_PARAM(LOWEST, 9) },
+ { "pxa-pcm-audio", "ac97_aux_mono_out", PDMA_FILTER_PARAM(LOWEST, 10) },
+ { "pxa-pcm-audio", "ac97_stereo_in", PDMA_FILTER_PARAM(LOWEST, 11) },
+ { "pxa-pcm-audio", "ac97_stereo_out", PDMA_FILTER_PARAM(LOWEST, 12) },
+ { "pxa-pcm-audio", "ssp1_rx", PDMA_FILTER_PARAM(LOWEST, 13) },
+ { "pxa-pcm-audio", "ssp1_tx", PDMA_FILTER_PARAM(LOWEST, 14) },
+ { "pxa-pcm-audio", "ssp2_rx", PDMA_FILTER_PARAM(LOWEST, 15) },
+ { "pxa-pcm-audio", "ssp2_tx", PDMA_FILTER_PARAM(LOWEST, 16) },
+ { "pxa2xx-ir", "rx", PDMA_FILTER_PARAM(LOWEST, 17) },
+ { "pxa2xx-ir", "tx", PDMA_FILTER_PARAM(LOWEST, 18) },
+ { "pxa2xx-mci.0", "rx", PDMA_FILTER_PARAM(LOWEST, 21) },
+ { "pxa2xx-mci.0", "tx", PDMA_FILTER_PARAM(LOWEST, 22) },
+ { "smc911x.0", "rx", PDMA_FILTER_PARAM(LOWEST, -1) },
+ { "smc911x.0", "tx", PDMA_FILTER_PARAM(LOWEST, -1) },
+ { "smc91x.0", "data", PDMA_FILTER_PARAM(LOWEST, -1) },
+
+ /* PXA25x specific map */
+ { "pxa25x-ssp.0", "rx", PDMA_FILTER_PARAM(LOWEST, 13) },
+ { "pxa25x-ssp.0", "tx", PDMA_FILTER_PARAM(LOWEST, 14) },
+ { "pxa25x-nssp.1", "rx", PDMA_FILTER_PARAM(LOWEST, 15) },
+ { "pxa25x-nssp.1", "tx", PDMA_FILTER_PARAM(LOWEST, 16) },
+ { "pxa25x-nssp.2", "rx", PDMA_FILTER_PARAM(LOWEST, 23) },
+ { "pxa25x-nssp.2", "tx", PDMA_FILTER_PARAM(LOWEST, 24) },
+ { "pxa-pcm-audio", "nssp2_rx", PDMA_FILTER_PARAM(LOWEST, 15) },
+ { "pxa-pcm-audio", "nssp2_tx", PDMA_FILTER_PARAM(LOWEST, 16) },
+ { "pxa-pcm-audio", "nssp3_rx", PDMA_FILTER_PARAM(LOWEST, 23) },
+ { "pxa-pcm-audio", "nssp3_tx", PDMA_FILTER_PARAM(LOWEST, 24) },
+
+ /* PXA27x specific map */
+ { "pxa-pcm-audio", "ssp3_rx", PDMA_FILTER_PARAM(LOWEST, 66) },
+ { "pxa-pcm-audio", "ssp3_tx", PDMA_FILTER_PARAM(LOWEST, 67) },
+ { "pxa27x-camera.0", "CI_Y", PDMA_FILTER_PARAM(HIGHEST, 68) },
+ { "pxa27x-camera.0", "CI_U", PDMA_FILTER_PARAM(HIGHEST, 69) },
+ { "pxa27x-camera.0", "CI_V", PDMA_FILTER_PARAM(HIGHEST, 70) },
+
+ /* PXA3xx specific map */
+ { "pxa-pcm-audio", "ssp4_rx", PDMA_FILTER_PARAM(LOWEST, 2) },
+ { "pxa-pcm-audio", "ssp4_tx", PDMA_FILTER_PARAM(LOWEST, 3) },
+ { "pxa2xx-mci.1", "rx", PDMA_FILTER_PARAM(LOWEST, 93) },
+ { "pxa2xx-mci.1", "tx", PDMA_FILTER_PARAM(LOWEST, 94) },
+ { "pxa3xx-nand", "data", PDMA_FILTER_PARAM(LOWEST, 97) },
+ { "pxa2xx-mci.2", "rx", PDMA_FILTER_PARAM(LOWEST, 100) },
+ { "pxa2xx-mci.2", "tx", PDMA_FILTER_PARAM(LOWEST, 101) },
+};
+
static struct mmp_dma_platdata pxa_dma_pdata = {
.dma_channels = 0,
.nb_requestors = 0,
+ .slave_map = pxa_slave_map,
+ .slave_map_cnt = ARRAY_SIZE(pxa_slave_map),
};

static struct resource pxa_dma_resource[] = {
--
2.11.0


2018-04-02 16:27:36

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH 12/15] dmaengine: pxa: make the filter function internal

Hi Robert,

I love your patch! Yet something to improve:

[auto build test ERROR on linus/master]
[also build test ERROR on v4.16]
[cannot apply to arm-soc/for-next next-20180329]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url: https://github.com/0day-ci/linux/commits/Robert-Jarzmik/ARM-pxa-switch-to-DMA-slave-maps/20180402-233029
config: i386-allmodconfig (attached as .config)
compiler: gcc-7 (Debian 7.3.0-1) 7.3.0
reproduce:
# save the attached .config to linux build tree
make ARCH=i386

All errors (new ones prefixed by >>):

In file included from drivers/mtd/nand/marvell_nand.c:21:0:
drivers/mtd/nand/marvell_nand.c: In function 'marvell_nfc_init_dma':
>> drivers/mtd/nand/marvell_nand.c:2621:42: error: 'pxad_filter_fn' undeclared (first use in this function); did you mean 'dma_filter_fn'?
dma_request_slave_channel_compat(mask, pxad_filter_fn,
^
include/linux/dmaengine.h:1408:46: note: in definition of macro 'dma_request_slave_channel_compat'
__dma_request_slave_channel_compat(&(mask), x, y, dev, name)
^
drivers/mtd/nand/marvell_nand.c:2621:42: note: each undeclared identifier is reported only once for each function it appears in
dma_request_slave_channel_compat(mask, pxad_filter_fn,
^
include/linux/dmaengine.h:1408:46: note: in definition of macro 'dma_request_slave_channel_compat'
__dma_request_slave_channel_compat(&(mask), x, y, dev, name)
^

vim +2621 drivers/mtd/nand/marvell_nand.c

02f26ecf Miquel Raynal 2018-01-09 2588
02f26ecf Miquel Raynal 2018-01-09 2589 static int marvell_nfc_init_dma(struct marvell_nfc *nfc)
02f26ecf Miquel Raynal 2018-01-09 2590 {
02f26ecf Miquel Raynal 2018-01-09 2591 struct platform_device *pdev = container_of(nfc->dev,
02f26ecf Miquel Raynal 2018-01-09 2592 struct platform_device,
02f26ecf Miquel Raynal 2018-01-09 2593 dev);
02f26ecf Miquel Raynal 2018-01-09 2594 struct dma_slave_config config = {};
02f26ecf Miquel Raynal 2018-01-09 2595 struct resource *r;
02f26ecf Miquel Raynal 2018-01-09 2596 dma_cap_mask_t mask;
02f26ecf Miquel Raynal 2018-01-09 2597 struct pxad_param param;
02f26ecf Miquel Raynal 2018-01-09 2598 int ret;
02f26ecf Miquel Raynal 2018-01-09 2599
02f26ecf Miquel Raynal 2018-01-09 2600 if (!IS_ENABLED(CONFIG_PXA_DMA)) {
02f26ecf Miquel Raynal 2018-01-09 2601 dev_warn(nfc->dev,
02f26ecf Miquel Raynal 2018-01-09 2602 "DMA not enabled in configuration\n");
02f26ecf Miquel Raynal 2018-01-09 2603 return -ENOTSUPP;
02f26ecf Miquel Raynal 2018-01-09 2604 }
02f26ecf Miquel Raynal 2018-01-09 2605
02f26ecf Miquel Raynal 2018-01-09 2606 ret = dma_set_mask_and_coherent(nfc->dev, DMA_BIT_MASK(32));
02f26ecf Miquel Raynal 2018-01-09 2607 if (ret)
02f26ecf Miquel Raynal 2018-01-09 2608 return ret;
02f26ecf Miquel Raynal 2018-01-09 2609
02f26ecf Miquel Raynal 2018-01-09 2610 r = platform_get_resource(pdev, IORESOURCE_DMA, 0);
02f26ecf Miquel Raynal 2018-01-09 2611 if (!r) {
02f26ecf Miquel Raynal 2018-01-09 2612 dev_err(nfc->dev, "No resource defined for data DMA\n");
02f26ecf Miquel Raynal 2018-01-09 2613 return -ENXIO;
02f26ecf Miquel Raynal 2018-01-09 2614 }
02f26ecf Miquel Raynal 2018-01-09 2615
02f26ecf Miquel Raynal 2018-01-09 2616 param.drcmr = r->start;
02f26ecf Miquel Raynal 2018-01-09 2617 param.prio = PXAD_PRIO_LOWEST;
02f26ecf Miquel Raynal 2018-01-09 2618 dma_cap_zero(mask);
02f26ecf Miquel Raynal 2018-01-09 2619 dma_cap_set(DMA_SLAVE, mask);
02f26ecf Miquel Raynal 2018-01-09 2620 nfc->dma_chan =
02f26ecf Miquel Raynal 2018-01-09 @2621 dma_request_slave_channel_compat(mask, pxad_filter_fn,
02f26ecf Miquel Raynal 2018-01-09 2622 &param, nfc->dev,
02f26ecf Miquel Raynal 2018-01-09 2623 "data");
02f26ecf Miquel Raynal 2018-01-09 2624 if (!nfc->dma_chan) {
02f26ecf Miquel Raynal 2018-01-09 2625 dev_err(nfc->dev,
02f26ecf Miquel Raynal 2018-01-09 2626 "Unable to request data DMA channel\n");
02f26ecf Miquel Raynal 2018-01-09 2627 return -ENODEV;
02f26ecf Miquel Raynal 2018-01-09 2628 }
02f26ecf Miquel Raynal 2018-01-09 2629
02f26ecf Miquel Raynal 2018-01-09 2630 r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
02f26ecf Miquel Raynal 2018-01-09 2631 if (!r)
02f26ecf Miquel Raynal 2018-01-09 2632 return -ENXIO;
02f26ecf Miquel Raynal 2018-01-09 2633
02f26ecf Miquel Raynal 2018-01-09 2634 config.src_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
02f26ecf Miquel Raynal 2018-01-09 2635 config.dst_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
02f26ecf Miquel Raynal 2018-01-09 2636 config.src_addr = r->start + NDDB;
02f26ecf Miquel Raynal 2018-01-09 2637 config.dst_addr = r->start + NDDB;
02f26ecf Miquel Raynal 2018-01-09 2638 config.src_maxburst = 32;
02f26ecf Miquel Raynal 2018-01-09 2639 config.dst_maxburst = 32;
02f26ecf Miquel Raynal 2018-01-09 2640 ret = dmaengine_slave_config(nfc->dma_chan, &config);
02f26ecf Miquel Raynal 2018-01-09 2641 if (ret < 0) {
02f26ecf Miquel Raynal 2018-01-09 2642 dev_err(nfc->dev, "Failed to configure DMA channel\n");
02f26ecf Miquel Raynal 2018-01-09 2643 return ret;
02f26ecf Miquel Raynal 2018-01-09 2644 }
02f26ecf Miquel Raynal 2018-01-09 2645
02f26ecf Miquel Raynal 2018-01-09 2646 /*
02f26ecf Miquel Raynal 2018-01-09 2647 * DMA must act on length multiple of 32 and this length may be
02f26ecf Miquel Raynal 2018-01-09 2648 * bigger than the destination buffer. Use this buffer instead
02f26ecf Miquel Raynal 2018-01-09 2649 * for DMA transfers and then copy the desired amount of data to
02f26ecf Miquel Raynal 2018-01-09 2650 * the provided buffer.
02f26ecf Miquel Raynal 2018-01-09 2651 */
c495a927 Miquel Raynal 2018-01-19 2652 nfc->dma_buf = kmalloc(MAX_CHUNK_SIZE, GFP_KERNEL | GFP_DMA);
02f26ecf Miquel Raynal 2018-01-09 2653 if (!nfc->dma_buf)
02f26ecf Miquel Raynal 2018-01-09 2654 return -ENOMEM;
02f26ecf Miquel Raynal 2018-01-09 2655
02f26ecf Miquel Raynal 2018-01-09 2656 nfc->use_dma = true;
02f26ecf Miquel Raynal 2018-01-09 2657
02f26ecf Miquel Raynal 2018-01-09 2658 return 0;
02f26ecf Miquel Raynal 2018-01-09 2659 }
02f26ecf Miquel Raynal 2018-01-09 2660

:::::: The code at line 2621 was first introduced by commit
:::::: 02f26ecf8c772751d4b24744d487f6b1b20e75d4 mtd: nand: add reworked Marvell NAND controller driver

:::::: TO: Miquel Raynal <[email protected]>
:::::: CC: Boris Brezillon <[email protected]>

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation


Attachments:
(No filename) (6.91 kB)
.config.gz (61.58 kB)
Download all attachments

2018-04-02 16:37:27

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH 12/15] dmaengine: pxa: make the filter function internal

Hi Robert,

I love your patch! Perhaps something to improve:

[auto build test WARNING on linus/master]
[also build test WARNING on v4.16]
[cannot apply to arm-soc/for-next next-20180329]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url: https://github.com/0day-ci/linux/commits/Robert-Jarzmik/ARM-pxa-switch-to-DMA-slave-maps/20180402-233029
reproduce:
# apt-get install sparse
make ARCH=x86_64 allmodconfig
make C=1 CF=-D__CHECK_ENDIAN__


sparse warnings: (new ones prefixed by >>)

drivers/mtd/nand/marvell_nand.c:2621:17: sparse: undefined identifier 'pxad_filter_fn'
>> drivers/mtd/nand/marvell_nand.c:2621:17: sparse: call with no type!
In file included from drivers/mtd/nand/marvell_nand.c:21:0:
drivers/mtd/nand/marvell_nand.c: In function 'marvell_nfc_init_dma':
drivers/mtd/nand/marvell_nand.c:2621:42: error: 'pxad_filter_fn' undeclared (first use in this function); did you mean 'dma_filter_fn'?
dma_request_slave_channel_compat(mask, pxad_filter_fn,
^
include/linux/dmaengine.h:1408:46: note: in definition of macro 'dma_request_slave_channel_compat'
__dma_request_slave_channel_compat(&(mask), x, y, dev, name)
^
drivers/mtd/nand/marvell_nand.c:2621:42: note: each undeclared identifier is reported only once for each function it appears in
dma_request_slave_channel_compat(mask, pxad_filter_fn,
^
include/linux/dmaengine.h:1408:46: note: in definition of macro 'dma_request_slave_channel_compat'
__dma_request_slave_channel_compat(&(mask), x, y, dev, name)
^

vim +2621 drivers/mtd/nand/marvell_nand.c

02f26ecf Miquel Raynal 2018-01-09 2588
02f26ecf Miquel Raynal 2018-01-09 2589 static int marvell_nfc_init_dma(struct marvell_nfc *nfc)
02f26ecf Miquel Raynal 2018-01-09 2590 {
02f26ecf Miquel Raynal 2018-01-09 2591 struct platform_device *pdev = container_of(nfc->dev,
02f26ecf Miquel Raynal 2018-01-09 2592 struct platform_device,
02f26ecf Miquel Raynal 2018-01-09 2593 dev);
02f26ecf Miquel Raynal 2018-01-09 2594 struct dma_slave_config config = {};
02f26ecf Miquel Raynal 2018-01-09 2595 struct resource *r;
02f26ecf Miquel Raynal 2018-01-09 2596 dma_cap_mask_t mask;
02f26ecf Miquel Raynal 2018-01-09 2597 struct pxad_param param;
02f26ecf Miquel Raynal 2018-01-09 2598 int ret;
02f26ecf Miquel Raynal 2018-01-09 2599
02f26ecf Miquel Raynal 2018-01-09 2600 if (!IS_ENABLED(CONFIG_PXA_DMA)) {
02f26ecf Miquel Raynal 2018-01-09 2601 dev_warn(nfc->dev,
02f26ecf Miquel Raynal 2018-01-09 2602 "DMA not enabled in configuration\n");
02f26ecf Miquel Raynal 2018-01-09 2603 return -ENOTSUPP;
02f26ecf Miquel Raynal 2018-01-09 2604 }
02f26ecf Miquel Raynal 2018-01-09 2605
02f26ecf Miquel Raynal 2018-01-09 2606 ret = dma_set_mask_and_coherent(nfc->dev, DMA_BIT_MASK(32));
02f26ecf Miquel Raynal 2018-01-09 2607 if (ret)
02f26ecf Miquel Raynal 2018-01-09 2608 return ret;
02f26ecf Miquel Raynal 2018-01-09 2609
02f26ecf Miquel Raynal 2018-01-09 2610 r = platform_get_resource(pdev, IORESOURCE_DMA, 0);
02f26ecf Miquel Raynal 2018-01-09 2611 if (!r) {
02f26ecf Miquel Raynal 2018-01-09 2612 dev_err(nfc->dev, "No resource defined for data DMA\n");
02f26ecf Miquel Raynal 2018-01-09 2613 return -ENXIO;
02f26ecf Miquel Raynal 2018-01-09 2614 }
02f26ecf Miquel Raynal 2018-01-09 2615
02f26ecf Miquel Raynal 2018-01-09 2616 param.drcmr = r->start;
02f26ecf Miquel Raynal 2018-01-09 2617 param.prio = PXAD_PRIO_LOWEST;
02f26ecf Miquel Raynal 2018-01-09 2618 dma_cap_zero(mask);
02f26ecf Miquel Raynal 2018-01-09 2619 dma_cap_set(DMA_SLAVE, mask);
02f26ecf Miquel Raynal 2018-01-09 2620 nfc->dma_chan =
02f26ecf Miquel Raynal 2018-01-09 @2621 dma_request_slave_channel_compat(mask, pxad_filter_fn,
02f26ecf Miquel Raynal 2018-01-09 2622 &param, nfc->dev,
02f26ecf Miquel Raynal 2018-01-09 2623 "data");
02f26ecf Miquel Raynal 2018-01-09 2624 if (!nfc->dma_chan) {
02f26ecf Miquel Raynal 2018-01-09 2625 dev_err(nfc->dev,
02f26ecf Miquel Raynal 2018-01-09 2626 "Unable to request data DMA channel\n");
02f26ecf Miquel Raynal 2018-01-09 2627 return -ENODEV;
02f26ecf Miquel Raynal 2018-01-09 2628 }
02f26ecf Miquel Raynal 2018-01-09 2629
02f26ecf Miquel Raynal 2018-01-09 2630 r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
02f26ecf Miquel Raynal 2018-01-09 2631 if (!r)
02f26ecf Miquel Raynal 2018-01-09 2632 return -ENXIO;
02f26ecf Miquel Raynal 2018-01-09 2633
02f26ecf Miquel Raynal 2018-01-09 2634 config.src_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
02f26ecf Miquel Raynal 2018-01-09 2635 config.dst_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
02f26ecf Miquel Raynal 2018-01-09 2636 config.src_addr = r->start + NDDB;
02f26ecf Miquel Raynal 2018-01-09 2637 config.dst_addr = r->start + NDDB;
02f26ecf Miquel Raynal 2018-01-09 2638 config.src_maxburst = 32;
02f26ecf Miquel Raynal 2018-01-09 2639 config.dst_maxburst = 32;
02f26ecf Miquel Raynal 2018-01-09 2640 ret = dmaengine_slave_config(nfc->dma_chan, &config);
02f26ecf Miquel Raynal 2018-01-09 2641 if (ret < 0) {
02f26ecf Miquel Raynal 2018-01-09 2642 dev_err(nfc->dev, "Failed to configure DMA channel\n");
02f26ecf Miquel Raynal 2018-01-09 2643 return ret;
02f26ecf Miquel Raynal 2018-01-09 2644 }
02f26ecf Miquel Raynal 2018-01-09 2645
02f26ecf Miquel Raynal 2018-01-09 2646 /*
02f26ecf Miquel Raynal 2018-01-09 2647 * DMA must act on length multiple of 32 and this length may be
02f26ecf Miquel Raynal 2018-01-09 2648 * bigger than the destination buffer. Use this buffer instead
02f26ecf Miquel Raynal 2018-01-09 2649 * for DMA transfers and then copy the desired amount of data to
02f26ecf Miquel Raynal 2018-01-09 2650 * the provided buffer.
02f26ecf Miquel Raynal 2018-01-09 2651 */
c495a927 Miquel Raynal 2018-01-19 2652 nfc->dma_buf = kmalloc(MAX_CHUNK_SIZE, GFP_KERNEL | GFP_DMA);
02f26ecf Miquel Raynal 2018-01-09 2653 if (!nfc->dma_buf)
02f26ecf Miquel Raynal 2018-01-09 2654 return -ENOMEM;
02f26ecf Miquel Raynal 2018-01-09 2655
02f26ecf Miquel Raynal 2018-01-09 2656 nfc->use_dma = true;
02f26ecf Miquel Raynal 2018-01-09 2657
02f26ecf Miquel Raynal 2018-01-09 2658 return 0;
02f26ecf Miquel Raynal 2018-01-09 2659 }
02f26ecf Miquel Raynal 2018-01-09 2660

:::::: The code at line 2621 was first introduced by commit
:::::: 02f26ecf8c772751d4b24744d487f6b1b20e75d4 mtd: nand: add reworked Marvell NAND controller driver

:::::: TO: Miquel Raynal <[email protected]>
:::::: CC: Boris Brezillon <[email protected]>

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

2018-04-02 19:17:56

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH 15/15] ARM: pxa: change SSP DMA channels allocation

Hi Robert,

I love your patch! Yet something to improve:

[auto build test ERROR on linus/master]
[also build test ERROR on v4.16]
[cannot apply to arm-soc/for-next next-20180329]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url: https://github.com/0day-ci/linux/commits/Robert-Jarzmik/ARM-pxa-switch-to-DMA-slave-maps/20180402-233029
config: arm-allmodconfig (attached as .config)
compiler: arm-linux-gnueabi-gcc (Debian 7.2.0-11) 7.2.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=arm

All errors (new ones prefixed by >>):

>> arch/arm/plat-pxa/ssp.c:19:10: fatal error: mach/audio.h: No such file or directory
#include <mach/audio.h>
^~~~~~~~~~~~~~
compilation terminated.

vim +19 arch/arm/plat-pxa/ssp.c

> 19 #include <mach/audio.h>
20 #include <linux/module.h>
21 #include <linux/kernel.h>
22 #include <linux/sched.h>
23 #include <linux/slab.h>
24 #include <linux/errno.h>
25 #include <linux/interrupt.h>
26 #include <linux/ioport.h>
27 #include <linux/init.h>
28 #include <linux/mutex.h>
29 #include <linux/clk.h>
30 #include <linux/err.h>
31 #include <linux/platform_device.h>
32 #include <linux/spi/pxa2xx_spi.h>
33 #include <linux/io.h>
34 #include <linux/of.h>
35 #include <linux/of_device.h>
36

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation


Attachments:
(No filename) (1.71 kB)
.config.gz (63.59 kB)
Download all attachments

2018-04-03 06:53:21

by Arnd Bergmann

[permalink] [raw]
Subject: Re: [PATCH 02/15] ARM: pxa: add dma slave map

On Mon, Apr 2, 2018 at 4:26 PM, Robert Jarzmik <[email protected]> wrote:
> +
> +static const struct dma_slave_map pxa_slave_map[] = {
> + /* PXA25x, PXA27x and PXA3xx common entries */
> + { "pxa-pcm-audio", "ac97_mic_mono", PDMA_FILTER_PARAM(LOWEST, 8) },
> + { "pxa-pcm-audio", "ac97_aux_mono_in", PDMA_FILTER_PARAM(LOWEST, 9) },
> + { "pxa-pcm-audio", "ac97_aux_mono_out", PDMA_FILTER_PARAM(LOWEST, 10) },
> + { "pxa-pcm-audio", "ac97_stereo_in", PDMA_FILTER_PARAM(LOWEST, 11) },
> + { "pxa-pcm-audio", "ac97_stereo_out", PDMA_FILTER_PARAM(LOWEST, 12) },
> + { "pxa-pcm-audio", "ssp1_rx", PDMA_FILTER_PARAM(LOWEST, 13) },
> + { "pxa-pcm-audio", "ssp1_tx", PDMA_FILTER_PARAM(LOWEST, 14) },
> + { "pxa-pcm-audio", "ssp2_rx", PDMA_FILTER_PARAM(LOWEST, 15) },
> + { "pxa-pcm-audio", "ssp2_tx", PDMA_FILTER_PARAM(LOWEST, 16) },
> + { "pxa2xx-ir", "rx", PDMA_FILTER_PARAM(LOWEST, 17) },
> + { "pxa2xx-ir", "tx", PDMA_FILTER_PARAM(LOWEST, 18) },
> + { "pxa2xx-mci.0", "rx", PDMA_FILTER_PARAM(LOWEST, 21) },
> + { "pxa2xx-mci.0", "tx", PDMA_FILTER_PARAM(LOWEST, 22) },


> + { "smc911x.0", "rx", PDMA_FILTER_PARAM(LOWEST, -1) },
> + { "smc911x.0", "tx", PDMA_FILTER_PARAM(LOWEST, -1) },
> + { "smc91x.0", "data", PDMA_FILTER_PARAM(LOWEST, -1) },

This one is interesting, as you are dealing with an off-chip device,
and the channel number is '-'1. How does this even work? Does it
mean

> + /* PXA25x specific map */
> + { "pxa25x-ssp.0", "rx", PDMA_FILTER_PARAM(LOWEST, 13) },
> + { "pxa25x-ssp.0", "tx", PDMA_FILTER_PARAM(LOWEST, 14) },
> + { "pxa25x-nssp.1", "rx", PDMA_FILTER_PARAM(LOWEST, 15) },
> + { "pxa25x-nssp.1", "tx", PDMA_FILTER_PARAM(LOWEST, 16) },
> + { "pxa25x-nssp.2", "rx", PDMA_FILTER_PARAM(LOWEST, 23) },
> + { "pxa25x-nssp.2", "tx", PDMA_FILTER_PARAM(LOWEST, 24) },
> + { "pxa-pcm-audio", "nssp2_rx", PDMA_FILTER_PARAM(LOWEST, 15) },
> + { "pxa-pcm-audio", "nssp2_tx", PDMA_FILTER_PARAM(LOWEST, 16) },
> + { "pxa-pcm-audio", "nssp3_rx", PDMA_FILTER_PARAM(LOWEST, 23) },
> + { "pxa-pcm-audio", "nssp3_tx", PDMA_FILTER_PARAM(LOWEST, 24) },
> +
> + /* PXA27x specific map */
> + { "pxa-pcm-audio", "ssp3_rx", PDMA_FILTER_PARAM(LOWEST, 66) },
> + { "pxa-pcm-audio", "ssp3_tx", PDMA_FILTER_PARAM(LOWEST, 67) },
> + { "pxa27x-camera.0", "CI_Y", PDMA_FILTER_PARAM(HIGHEST, 68) },
> + { "pxa27x-camera.0", "CI_U", PDMA_FILTER_PARAM(HIGHEST, 69) },
> + { "pxa27x-camera.0", "CI_V", PDMA_FILTER_PARAM(HIGHEST, 70) },
> +
> + /* PXA3xx specific map */
> + { "pxa-pcm-audio", "ssp4_rx", PDMA_FILTER_PARAM(LOWEST, 2) },
> + { "pxa-pcm-audio", "ssp4_tx", PDMA_FILTER_PARAM(LOWEST, 3) },
> + { "pxa2xx-mci.1", "rx", PDMA_FILTER_PARAM(LOWEST, 93) },
> + { "pxa2xx-mci.1", "tx", PDMA_FILTER_PARAM(LOWEST, 94) },
> + { "pxa3xx-nand", "data", PDMA_FILTER_PARAM(LOWEST, 97) },
> + { "pxa2xx-mci.2", "rx", PDMA_FILTER_PARAM(LOWEST, 100) },
> + { "pxa2xx-mci.2", "tx", PDMA_FILTER_PARAM(LOWEST, 101) },
> +};

Since more than half the entries in here are chip specific, maybe it would be
better to split that table into three and have a copy for each one in
arch/arm/mach-pxa/pxa{25x.27x.3xx}.c? Does that mean it's actually
a memory-to-memory transfer with a device being on the external
SRAM interface?

Arnd

2018-04-03 07:08:26

by Arnd Bergmann

[permalink] [raw]
Subject: Re: [PATCH 14/15] ARM: pxa: change SSP devices allocation

On Mon, Apr 2, 2018 at 4:26 PM, Robert Jarzmik <[email protected]> wrote:

>
> +static struct pxa_ssp_info pxa_ssp_infos[] = {
> + { .dma_chan_rx_name = "ssp1_rx", .dma_chan_tx_name = "ssp1_tx", },
> + { .dma_chan_rx_name = "ssp1_rx", .dma_chan_tx_name = "ssp1_tx", },
> + { .dma_chan_rx_name = "ssp2_rx", .dma_chan_tx_name = "ssp2_tx", },
> + { .dma_chan_rx_name = "ssp2_rx", .dma_chan_tx_name = "ssp2_tx", },
> + { .dma_chan_rx_name = "ssp3_rx", .dma_chan_tx_name = "ssp3_tx", },
> + { .dma_chan_rx_name = "ssp3_rx", .dma_chan_tx_name = "ssp3_tx", },
> + { .dma_chan_rx_name = "ssp4_rx", .dma_chan_tx_name = "ssp4_tx", },
> + { .dma_chan_rx_name = "ssp4_rx", .dma_chan_tx_name = "ssp4_tx", },
> +};

This part looks odd to me, you're adding an extra level of indirection to
do two stages of lookups in some form of platform data.

Why can't you just always use "rx" and "tx" as the names here?

(also, I don't see why each line is duplicated, but I'm sure there's
an easy answer for that).

Arnd

2018-04-03 07:15:04

by Arnd Bergmann

[permalink] [raw]
Subject: Re: [PATCH 12/15] dmaengine: pxa: make the filter function internal

On Mon, Apr 2, 2018 at 6:35 PM, kbuild test robot <[email protected]> wrote:

>
> drivers/mtd/nand/marvell_nand.c:2621:17: sparse: undefined identifier 'pxad_filter_fn'
>>> drivers/mtd/nand/marvell_nand.c:2621:17: sparse: call with no type!
> In file included from drivers/mtd/nand/marvell_nand.c:21:0:
> drivers/mtd/nand/marvell_nand.c: In function 'marvell_nfc_init_dma':
> drivers/mtd/nand/marvell_nand.c:2621:42: error: 'pxad_filter_fn' undeclared (first use in this function); did you mean 'dma_filter_fn'?
> dma_request_slave_channel_compat(mask, pxad_filter_fn,
> ^
> include/linux/dmaengine.h:1408:46: note: in definition of macro 'dma_request_slave_channel_compat'
> __dma_request_slave_channel_compat(&(mask), x, y, dev, name)
> ^
> drivers/mtd/nand/marvell_nand.c:2621:42: note: each undeclared identifier is reported only once for each function it appears in
> dma_request_slave_channel_compat(mask, pxad_filter_fn,
> ^
> include/linux/dmaengine.h:1408:46: note: in definition of macro 'dma_request_slave_channel_compat'
> __dma_request_slave_channel_compat(&(mask), x, y, dev, name)

The driver is a replacement for the pxa3xx nand driver, so it now has
to get changed as well.

Arnd

2018-04-03 07:17:01

by Arnd Bergmann

[permalink] [raw]
Subject: Re: [PATCH 00/15] ARM: pxa: switch to DMA slave maps

On Mon, Apr 2, 2018 at 4:26 PM, Robert Jarzmik <[email protected]> wrote:
> Hi,
>
> This serie is aimed at removing the dmaengine slave compat use, and transfer
> knowledge of the DMA requestors into architecture code.
>
> This was discussed/advised by Arnd a couple of years back, it's almost time.
>
> The serie is divided in 3 phasees :
> - phase 1 : patch 1/15 and patch 2/15
> => this is the preparation work
> - phase 2 : patches 3/15 .. 10/15
> => this is the switch of all the drivers
> => this one will require either an Ack of the maintainers or be taken by them
> once phase 1 is merged
> - phase 3 : patches 11/15
> => this is the last part, cleanup and removal of export of the DMA filter
> function
>
> As this looks like a patch bomb, each maintainer expressing for his tree either
> an Ack or "I want to take through my tree" will be spared in the next iterations
> of this serie.
>
> Several of these changes have been tested on actual hardware, including :
> - pxamci
> - pxa_camera
> - smc*
> - ASoC and SSP
>
> Happy review.

This looks really great overall, thanks for cleaning this up!

The SSP part is still a bit weird, as I commented, but I'm sure we can
figure something out there.

Arnd

2018-04-03 15:10:08

by Ulf Hansson

[permalink] [raw]
Subject: Re: [PATCH 00/15] ARM: pxa: switch to DMA slave maps

On 2 April 2018 at 16:26, Robert Jarzmik <[email protected]> wrote:
> Hi,
>
> This serie is aimed at removing the dmaengine slave compat use, and transfer
> knowledge of the DMA requestors into architecture code.
>
> This was discussed/advised by Arnd a couple of years back, it's almost time.
>
> The serie is divided in 3 phasees :
> - phase 1 : patch 1/15 and patch 2/15
> => this is the preparation work
> - phase 2 : patches 3/15 .. 10/15
> => this is the switch of all the drivers
> => this one will require either an Ack of the maintainers or be taken by them
> once phase 1 is merged
> - phase 3 : patches 11/15
> => this is the last part, cleanup and removal of export of the DMA filter
> function
>
> As this looks like a patch bomb, each maintainer expressing for his tree either
> an Ack or "I want to take through my tree" will be spared in the next iterations
> of this serie.

Perhaps an option is to send this hole series as PR for 3.17 rc1, that
would removed some churns and make this faster/easier? Well, if you
receive the needed acks of course.

For the mmc change:

Acked-by: Ulf Hansson <[email protected]>

Kind regards
Uffe

>
> Several of these changes have been tested on actual hardware, including :
> - pxamci
> - pxa_camera
> - smc*
> - ASoC and SSP
>
> Happy review.
>
> Robert Jarzmik (15):
> dmaengine: pxa: use a dma slave map
> ARM: pxa: add dma slave map
> mmc: pxamci: remove the dmaengine compat need
> media: pxa_camera: remove the dmaengine compat need
> mtd: nand: pxa3xx: remove the dmaengine compat need
> net: smc911x: remove the dmaengine compat need
> net: smc91x: remove the dmaengine compat need
> ASoC: pxa: remove the dmaengine compat need
> net: irda: pxaficp_ir: remove the dmaengine compat need
> ata: pata_pxa: remove the dmaengine compat need
> dmaengine: pxa: document pxad_param
> dmaengine: pxa: make the filter function internal
> ARM: pxa: remove the DMA IO resources
> ARM: pxa: change SSP devices allocation
> ARM: pxa: change SSP DMA channels allocation
>
> arch/arm/mach-pxa/devices.c | 269 ++++++++++++++----------------
> arch/arm/mach-pxa/devices.h | 14 +-
> arch/arm/mach-pxa/include/mach/audio.h | 12 ++
> arch/arm/mach-pxa/pxa25x.c | 4 +-
> arch/arm/mach-pxa/pxa27x.c | 4 +-
> arch/arm/mach-pxa/pxa3xx.c | 5 +-
> arch/arm/plat-pxa/ssp.c | 50 +-----
> drivers/ata/pata_pxa.c | 10 +-
> drivers/dma/pxa_dma.c | 13 +-
> drivers/media/platform/pxa_camera.c | 22 +--
> drivers/mmc/host/pxamci.c | 29 +---
> drivers/mtd/nand/pxa3xx_nand.c | 10 +-
> drivers/net/ethernet/smsc/smc911x.c | 16 +-
> drivers/net/ethernet/smsc/smc91x.c | 12 +-
> drivers/net/ethernet/smsc/smc91x.h | 1 -
> drivers/staging/irda/drivers/pxaficp_ir.c | 14 +-
> include/linux/dma/pxa-dma.h | 20 +--
> include/linux/platform_data/mmp_dma.h | 4 +
> include/linux/pxa2xx_ssp.h | 4 +-
> sound/arm/pxa2xx-ac97.c | 14 +-
> sound/arm/pxa2xx-pcm-lib.c | 6 +-
> sound/soc/pxa/pxa-ssp.c | 5 +-
> sound/soc/pxa/pxa2xx-ac97.c | 32 +---
> 23 files changed, 196 insertions(+), 374 deletions(-)
>
> --
> 2.11.0
>

2018-04-03 15:20:37

by Robert Jarzmik

[permalink] [raw]
Subject: Re: [PATCH 02/15] ARM: pxa: add dma slave map

Arnd Bergmann <[email protected]> writes:

>> + { "smc911x.0", "rx", PDMA_FILTER_PARAM(LOWEST, -1) },
>> + { "smc911x.0", "tx", PDMA_FILTER_PARAM(LOWEST, -1) },
>> + { "smc91x.0", "data", PDMA_FILTER_PARAM(LOWEST, -1) },
>
> This one is interesting, as you are dealing with an off-chip device,
> and the channel number is '-'1. How does this even work? Does it
> mean

This relies on pxa_dma, in which the "-1" for a requestor line means "no
requestor" or said in another way "always requesting". As a consequence, as soon
as the DMA descriptors are queued, the transfer begins, and it is supposed
implicitely that the FIFO output availability is at least as quick as the system
bus and the DMA size is perfectly fit for the FIFO available bytes.

This is what has been the underlying of DMA transfers of smc91x(x) on the PXA
platforms, where the smc91x(s) are directly wired on the system bus (the same
bus having DRAM, SRAM, IO-mapped devices).

>
>> + /* PXA25x specific map */
>> + { "pxa25x-ssp.0", "rx", PDMA_FILTER_PARAM(LOWEST, 13) },
>> + { "pxa25x-ssp.0", "tx", PDMA_FILTER_PARAM(LOWEST, 14) },
>> + { "pxa25x-nssp.1", "rx", PDMA_FILTER_PARAM(LOWEST, 15) },
>> + { "pxa25x-nssp.1", "tx", PDMA_FILTER_PARAM(LOWEST, 16) },
>> + { "pxa25x-nssp.2", "rx", PDMA_FILTER_PARAM(LOWEST, 23) },
>> + { "pxa25x-nssp.2", "tx", PDMA_FILTER_PARAM(LOWEST, 24) },
>> + { "pxa-pcm-audio", "nssp2_rx", PDMA_FILTER_PARAM(LOWEST, 15) },
>> + { "pxa-pcm-audio", "nssp2_tx", PDMA_FILTER_PARAM(LOWEST, 16) },
>> + { "pxa-pcm-audio", "nssp3_rx", PDMA_FILTER_PARAM(LOWEST, 23) },
>> + { "pxa-pcm-audio", "nssp3_tx", PDMA_FILTER_PARAM(LOWEST, 24) },
>> +
>> + /* PXA27x specific map */
>> + { "pxa-pcm-audio", "ssp3_rx", PDMA_FILTER_PARAM(LOWEST, 66) },
>> + { "pxa-pcm-audio", "ssp3_tx", PDMA_FILTER_PARAM(LOWEST, 67) },
>> + { "pxa27x-camera.0", "CI_Y", PDMA_FILTER_PARAM(HIGHEST, 68) },
>> + { "pxa27x-camera.0", "CI_U", PDMA_FILTER_PARAM(HIGHEST, 69) },
>> + { "pxa27x-camera.0", "CI_V", PDMA_FILTER_PARAM(HIGHEST, 70) },
>> +
>> + /* PXA3xx specific map */
>> + { "pxa-pcm-audio", "ssp4_rx", PDMA_FILTER_PARAM(LOWEST, 2) },
>> + { "pxa-pcm-audio", "ssp4_tx", PDMA_FILTER_PARAM(LOWEST, 3) },
>> + { "pxa2xx-mci.1", "rx", PDMA_FILTER_PARAM(LOWEST, 93) },
>> + { "pxa2xx-mci.1", "tx", PDMA_FILTER_PARAM(LOWEST, 94) },
>> + { "pxa3xx-nand", "data", PDMA_FILTER_PARAM(LOWEST, 97) },
>> + { "pxa2xx-mci.2", "rx", PDMA_FILTER_PARAM(LOWEST, 100) },
>> + { "pxa2xx-mci.2", "tx", PDMA_FILTER_PARAM(LOWEST, 101) },
>> +};
>
> Since more than half the entries in here are chip specific, maybe it would be
> better to split that table into three and have a copy for each one in
> arch/arm/mach-pxa/pxa{25x.27x.3xx}.c?
Mmmh, today the split is :
- 16 common entries
- 10 pxa25x specific entries
- 5 pxa27x specific entries
- 7 pxa3xx specific entries
=> total of 38 lines

After the split we'll have :
- 26 pxa25x specific entries
- 21 pxa27x specific entries
- 23 pxa3xx specific entries
=> total of 70 lines

That doubles the number of lines, not counting the declarations, and amending of
pxa2xx_set_dmac_info().

If you think it's worth it, what is the driving benefit behind ?

> Does that mean it's actually a memory-to-memory transfer with a device being
> on the external SRAM interface?
I'm taking this is the follow up to the "-1" question :0

Cheers.

--
Robert

2018-04-03 15:34:30

by Robert Jarzmik

[permalink] [raw]
Subject: Re: [PATCH 14/15] ARM: pxa: change SSP devices allocation

Arnd Bergmann <[email protected]> writes:

chop chop ... removed several mail recipients to leave only the ASoC / PXA
subset ...

> On Mon, Apr 2, 2018 at 4:26 PM, Robert Jarzmik <[email protected]> wrote:
>
>>
>> +static struct pxa_ssp_info pxa_ssp_infos[] = {
>> + { .dma_chan_rx_name = "ssp1_rx", .dma_chan_tx_name = "ssp1_tx", },
>> + { .dma_chan_rx_name = "ssp1_rx", .dma_chan_tx_name = "ssp1_tx", },
>> + { .dma_chan_rx_name = "ssp2_rx", .dma_chan_tx_name = "ssp2_tx", },
>> + { .dma_chan_rx_name = "ssp2_rx", .dma_chan_tx_name = "ssp2_tx", },
>> + { .dma_chan_rx_name = "ssp3_rx", .dma_chan_tx_name = "ssp3_tx", },
>> + { .dma_chan_rx_name = "ssp3_rx", .dma_chan_tx_name = "ssp3_tx", },
>> + { .dma_chan_rx_name = "ssp4_rx", .dma_chan_tx_name = "ssp4_tx", },
>> + { .dma_chan_rx_name = "ssp4_rx", .dma_chan_tx_name = "ssp4_tx", },
>> +};
>
> This part looks odd to me, you're adding an extra level of indirection to
> do two stages of lookups in some form of platform data.
That's unfortunately right.

> Why can't you just always use "rx" and "tx" as the names here?
Well I couldn't. I'll explain you why, and maybe you'll find a better solution.

That all is related to how ASoC and SSP interact.
If I remember correctly, here is how it works :
- the DMA channel is requested in sound/arm/pxa2xx-pcm-lib.c:128
return snd_dmaengine_pcm_open(
substream, dma_request_slave_channel(rtd->platform->dev,
The trick is that the device here is _not_ the SSP one, it's if memory serves
me well the pxa-pcm-audio one.

As a consequence, the device cannot be used to differenciate which SSP
exactly is providing the sound samples stream. This information is
nevertheless required to choose the correct requestor line, which is a 1-to-1
match to the SSP port.

The indirection in the channel name is used to choose the correct requestor
line for a given SSP port providing the samples.

It also must be underlined that this dma request serves both AC97 and SSP as
sample providers.

> (also, I don't see why each line is duplicated, but I'm sure there's
> an easy answer for that).
Ahh that is an unfortunate rebase most probably :)

Cheers.

--
Robert

2018-04-03 15:40:48

by Arnd Bergmann

[permalink] [raw]
Subject: Re: [PATCH 02/15] ARM: pxa: add dma slave map

On Tue, Apr 3, 2018 at 5:18 PM, Robert Jarzmik <[email protected]> wrote:
> Arnd Bergmann <[email protected]> writes:
>
>>> + { "smc911x.0", "rx", PDMA_FILTER_PARAM(LOWEST, -1) },
>>> + { "smc911x.0", "tx", PDMA_FILTER_PARAM(LOWEST, -1) },
>>> + { "smc91x.0", "data", PDMA_FILTER_PARAM(LOWEST, -1) },
>>
>> This one is interesting, as you are dealing with an off-chip device,
>> and the channel number is '-'1. How does this even work? Does it
>> mean
>
> This relies on pxa_dma, in which the "-1" for a requestor line means "no
> requestor" or said in another way "always requesting". As a consequence, as soon
> as the DMA descriptors are queued, the transfer begins, and it is supposed
> implicitely that the FIFO output availability is at least as quick as the system
> bus and the DMA size is perfectly fit for the FIFO available bytes.
>
> This is what has been the underlying of DMA transfers of smc91x(x) on the PXA
> platforms, where the smc91x(s) are directly wired on the system bus (the same
> bus having DRAM, SRAM, IO-mapped devices).

Ok, I looked at the driver in more detail now and found the scary parts.
So it's using the async DMA interface to do synchronous DMA in
interrupt context in order to transfer the rx data faster than an readsl()
would, correct?

It still feels odd to me that there is an entry in the slave map for
a device that does not have a request line. However, it also seems
that the entire code in those two drivers that deals with DMA is specific
to PXA anyway, so maybe it can be done differently: instead of
calling dma_request_slave_channel_compat() or dma_request_chan()
with a fake request line, how about calling dma_request_channel()
with an NULL filter function and data, and have the driver handle
the empty data case the same way as the rq=-1 case today?

>>> + /* PXA25x specific map */
>>> + { "pxa25x-ssp.0", "rx", PDMA_FILTER_PARAM(LOWEST, 13) },
>>> + { "pxa25x-ssp.0", "tx", PDMA_FILTER_PARAM(LOWEST, 14) },
>>> + { "pxa25x-nssp.1", "rx", PDMA_FILTER_PARAM(LOWEST, 15) },
>>> + { "pxa25x-nssp.1", "tx", PDMA_FILTER_PARAM(LOWEST, 16) },
>>> + { "pxa25x-nssp.2", "rx", PDMA_FILTER_PARAM(LOWEST, 23) },
>>> + { "pxa25x-nssp.2", "tx", PDMA_FILTER_PARAM(LOWEST, 24) },
>>> + { "pxa-pcm-audio", "nssp2_rx", PDMA_FILTER_PARAM(LOWEST, 15) },
>>> + { "pxa-pcm-audio", "nssp2_tx", PDMA_FILTER_PARAM(LOWEST, 16) },
>>> + { "pxa-pcm-audio", "nssp3_rx", PDMA_FILTER_PARAM(LOWEST, 23) },
>>> + { "pxa-pcm-audio", "nssp3_tx", PDMA_FILTER_PARAM(LOWEST, 24) },
>>> +
>>> + /* PXA27x specific map */
>>> + { "pxa-pcm-audio", "ssp3_rx", PDMA_FILTER_PARAM(LOWEST, 66) },
>>> + { "pxa-pcm-audio", "ssp3_tx", PDMA_FILTER_PARAM(LOWEST, 67) },
>>> + { "pxa27x-camera.0", "CI_Y", PDMA_FILTER_PARAM(HIGHEST, 68) },
>>> + { "pxa27x-camera.0", "CI_U", PDMA_FILTER_PARAM(HIGHEST, 69) },
>>> + { "pxa27x-camera.0", "CI_V", PDMA_FILTER_PARAM(HIGHEST, 70) },
>>> +
>>> + /* PXA3xx specific map */
>>> + { "pxa-pcm-audio", "ssp4_rx", PDMA_FILTER_PARAM(LOWEST, 2) },
>>> + { "pxa-pcm-audio", "ssp4_tx", PDMA_FILTER_PARAM(LOWEST, 3) },
>>> + { "pxa2xx-mci.1", "rx", PDMA_FILTER_PARAM(LOWEST, 93) },
>>> + { "pxa2xx-mci.1", "tx", PDMA_FILTER_PARAM(LOWEST, 94) },
>>> + { "pxa3xx-nand", "data", PDMA_FILTER_PARAM(LOWEST, 97) },
>>> + { "pxa2xx-mci.2", "rx", PDMA_FILTER_PARAM(LOWEST, 100) },
>>> + { "pxa2xx-mci.2", "tx", PDMA_FILTER_PARAM(LOWEST, 101) },
>>> +};
>>
>> Since more than half the entries in here are chip specific, maybe it would be
>> better to split that table into three and have a copy for each one in
>> arch/arm/mach-pxa/pxa{25x.27x.3xx}.c?
> Mmmh, today the split is :
> - 16 common entries
> - 10 pxa25x specific entries
> - 5 pxa27x specific entries
> - 7 pxa3xx specific entries
> => total of 38 lines
>
> After the split we'll have :
> - 26 pxa25x specific entries
> - 21 pxa27x specific entries
> - 23 pxa3xx specific entries
> => total of 70 lines
>
> That doubles the number of lines, not counting the declarations, and amending of
> pxa2xx_set_dmac_info().
>
> If you think it's worth it, what is the driving benefit behind ?

It seems a bit cleaner to only register the tables for the dma lines that
are actually present on a given chip.

>> Does that mean it's actually a memory-to-memory transfer with a device being
>> on the external SRAM interface?
> I'm taking this is the follow up to the "-1" question :0

Right.

Arnd

2018-04-03 15:55:01

by Arnd Bergmann

[permalink] [raw]
Subject: Re: [PATCH 14/15] ARM: pxa: change SSP devices allocation

On Tue, Apr 3, 2018 at 5:32 PM, Robert Jarzmik <[email protected]> wrote:
> Arnd Bergmann <[email protected]> writes:
>
> chop chop ... removed several mail recipients to leave only the ASoC / PXA
> subset ...
>
>> On Mon, Apr 2, 2018 at 4:26 PM, Robert Jarzmik <[email protected]> wrote:
>>
>>>
>>> +static struct pxa_ssp_info pxa_ssp_infos[] = {
>>> + { .dma_chan_rx_name = "ssp1_rx", .dma_chan_tx_name = "ssp1_tx", },
>>> + { .dma_chan_rx_name = "ssp1_rx", .dma_chan_tx_name = "ssp1_tx", },
>>> + { .dma_chan_rx_name = "ssp2_rx", .dma_chan_tx_name = "ssp2_tx", },
>>> + { .dma_chan_rx_name = "ssp2_rx", .dma_chan_tx_name = "ssp2_tx", },
>>> + { .dma_chan_rx_name = "ssp3_rx", .dma_chan_tx_name = "ssp3_tx", },
>>> + { .dma_chan_rx_name = "ssp3_rx", .dma_chan_tx_name = "ssp3_tx", },
>>> + { .dma_chan_rx_name = "ssp4_rx", .dma_chan_tx_name = "ssp4_tx", },
>>> + { .dma_chan_rx_name = "ssp4_rx", .dma_chan_tx_name = "ssp4_tx", },
>>> +};
>>
>> This part looks odd to me, you're adding an extra level of indirection to
>> do two stages of lookups in some form of platform data.
> That's unfortunately right.
>
>> Why can't you just always use "rx" and "tx" as the names here?
> Well I couldn't. I'll explain you why, and maybe you'll find a better solution.
>
> That all is related to how ASoC and SSP interact.
> If I remember correctly, here is how it works :
> - the DMA channel is requested in sound/arm/pxa2xx-pcm-lib.c:128
> return snd_dmaengine_pcm_open(
> substream, dma_request_slave_channel(rtd->platform->dev,
> The trick is that the device here is _not_ the SSP one, it's if memory serves
> me well the pxa-pcm-audio one.
>
> As a consequence, the device cannot be used to differenciate which SSP
> exactly is providing the sound samples stream. This information is
> nevertheless required to choose the correct requestor line, which is a 1-to-1
> match to the SSP port.
>
> The indirection in the channel name is used to choose the correct requestor
> line for a given SSP port providing the samples.
>
> It also must be underlined that this dma request serves both AC97 and SSP as
> sample providers.

I'm still unable to follow through that code, but I understand now that
the device you pass to dma_request_slave_channel() is not the one
we'd like it to be here.

Where exactly does that call to dma_request_chan() happen? Is this
the one in dmaengine_pcm_new()? Could we perhaps put a
pointer to the SSP device into snd_dmaengine_dai_dma_data?

Arnd

2018-04-03 20:21:06

by Robert Jarzmik

[permalink] [raw]
Subject: Re: [PATCH 02/15] ARM: pxa: add dma slave map

... chop chop removing unneeded recipients ....

Arnd Bergmann <[email protected]> writes:

> Ok, I looked at the driver in more detail now and found the scary parts.
> So it's using the async DMA interface to do synchronous DMA in
> interrupt context in order to transfer the rx data faster than an readsl()
> would, correct?
That's correct, at least for the smc91x.

> It still feels odd to me that there is an entry in the slave map for
> a device that does not have a request line. However, it also seems
> that the entire code in those two drivers that deals with DMA is specific
> to PXA anyway, so maybe it can be done differently: instead of
> calling dma_request_slave_channel_compat() or dma_request_chan()
> with a fake request line, how about calling dma_request_channel()
> with an NULL filter function and data, and have the driver handle
> the empty data case the same way as the rq=-1 case today?
Okay, in this case :
- the channel priority cannot be passed anymore
- and I don't see how this can work :
dma_request_channel()
__dma_request_channel()
find_candidate()
private_candidate(mask, device, fn, fn_param);
/* Here, fn == NULL and fn_param == NULL as per your proposal */

This function will find the first available dma channel, all right, but
no function will be called in pxa_dma driver, and therefore the last
requestor of the channel will be used, which is bad.

>> If you think it's worth it, what is the driving benefit behind ?
> It seems a bit cleaner to only register the tables for the dma lines that
> are actually present on a given chip.
Okay, let's do this.

Cheers.

--
Robert

2018-04-04 10:20:44

by Arnd Bergmann

[permalink] [raw]
Subject: Re: [PATCH 02/15] ARM: pxa: add dma slave map

On Tue, Apr 3, 2018 at 10:19 PM, Robert Jarzmik <[email protected]> wrote:
> ... chop chop removing unneeded recipients ....
>
> Arnd Bergmann <[email protected]> writes:
>
>> Ok, I looked at the driver in more detail now and found the scary parts.
>> So it's using the async DMA interface to do synchronous DMA in
>> interrupt context in order to transfer the rx data faster than an readsl()
>> would, correct?
> That's correct, at least for the smc91x.
>
>> It still feels odd to me that there is an entry in the slave map for
>> a device that does not have a request line. However, it also seems
>> that the entire code in those two drivers that deals with DMA is specific
>> to PXA anyway, so maybe it can be done differently: instead of
>> calling dma_request_slave_channel_compat() or dma_request_chan()
>> with a fake request line, how about calling dma_request_channel()
>> with an NULL filter function and data, and have the driver handle
>> the empty data case the same way as the rq=-1 case today?
> Okay, in this case :
> - the channel priority cannot be passed anymore

Right, but it could just always use a static priority, right?

> - and I don't see how this can work :
> dma_request_channel()
> __dma_request_channel()
> find_candidate()
> private_candidate(mask, device, fn, fn_param);
> /* Here, fn == NULL and fn_param == NULL as per your proposal */
>
> This function will find the first available dma channel, all right, but
> no function will be called in pxa_dma driver, and therefore the last
> requestor of the channel will be used, which is bad.

Can't you just reset those in pxad_free_chan_resources()?

Arnd

2018-04-04 19:25:20

by Robert Jarzmik

[permalink] [raw]
Subject: Re: [PATCH 02/15] ARM: pxa: add dma slave map

Arnd Bergmann <[email protected]> writes:

> On Tue, Apr 3, 2018 at 10:19 PM, Robert Jarzmik <[email protected]> wrote:
>> ... chop chop removing unneeded recipients ....
>>
>> Arnd Bergmann <[email protected]> writes:
>>> It still feels odd to me that there is an entry in the slave map for
>>> a device that does not have a request line. However, it also seems
>>> that the entire code in those two drivers that deals with DMA is specific
>>> to PXA anyway, so maybe it can be done differently: instead of
>>> calling dma_request_slave_channel_compat() or dma_request_chan()
>>> with a fake request line, how about calling dma_request_channel()
>>> with an NULL filter function and data, and have the driver handle
>>> the empty data case the same way as the rq=-1 case today?
>> Okay, in this case :
>> - the channel priority cannot be passed anymore
>
> Right, but it could just always use a static priority, right?
Yes, an implicit default priority. I'm not a big fan of implicit parameters, yet
I can do it.

>> - and I don't see how this can work :
>> dma_request_channel()
>> __dma_request_channel()
>> find_candidate()
>> private_candidate(mask, device, fn, fn_param);
>> /* Here, fn == NULL and fn_param == NULL as per your proposal */
>>
>> This function will find the first available dma channel, all right, but
>> no function will be called in pxa_dma driver, and therefore the last
>> requestor of the channel will be used, which is bad.
>
> Can't you just reset those in pxad_free_chan_resources()?
I can, let's see what happens next ...

Cheers.

--
Robert

2018-04-04 19:51:04

by Robert Jarzmik

[permalink] [raw]
Subject: Re: [PATCH 00/15] ARM: pxa: switch to DMA slave maps

Ulf Hansson <[email protected]> writes:

> On 2 April 2018 at 16:26, Robert Jarzmik <[email protected]> wrote:
>> Hi,
>>
>> This serie is aimed at removing the dmaengine slave compat use, and transfer
>> knowledge of the DMA requestors into architecture code.
>> As this looks like a patch bomb, each maintainer expressing for his tree either
>> an Ack or "I want to take through my tree" will be spared in the next iterations
>> of this serie.
>
> Perhaps an option is to send this hole series as PR for 3.17 rc1, that
> would removed some churns and make this faster/easier? Well, if you
> receive the needed acks of course.
For 3.17-rc1 it looks a bit optimistic with the review time ... If I have all
acks, I'll queue it into my pxa tree. If at least one maintainer withholds his
ack, the end of the serie (phase 3) won't be applied until it is sorted out.

Cheers.

--
Robert

2018-04-04 19:58:25

by Boris Brezillon

[permalink] [raw]
Subject: Re: [PATCH 00/15] ARM: pxa: switch to DMA slave maps

On Wed, 04 Apr 2018 21:49:26 +0200
Robert Jarzmik <[email protected]> wrote:

> Ulf Hansson <[email protected]> writes:
>
> > On 2 April 2018 at 16:26, Robert Jarzmik <[email protected]> wrote:
> >> Hi,
> >>
> >> This serie is aimed at removing the dmaengine slave compat use, and transfer
> >> knowledge of the DMA requestors into architecture code.
> >> As this looks like a patch bomb, each maintainer expressing for his tree either
> >> an Ack or "I want to take through my tree" will be spared in the next iterations
> >> of this serie.
> >
> > Perhaps an option is to send this hole series as PR for 3.17 rc1, that
> > would removed some churns and make this faster/easier? Well, if you
> > receive the needed acks of course.
> For 3.17-rc1 it looks a bit optimistic with the review time ... If I have all

Especially since 3.17-rc1 has been released more than 3 years ago :-),
but I guess you meant 4.17-rc1.

> acks, I'll queue it into my pxa tree. If at least one maintainer withholds his
> ack, the end of the serie (phase 3) won't be applied until it is sorted out.
>
> Cheers.
>
> --
> Robert


2018-04-05 06:32:27

by Ulf Hansson

[permalink] [raw]
Subject: Re: [PATCH 00/15] ARM: pxa: switch to DMA slave maps

On 4 April 2018 at 21:56, Boris Brezillon <[email protected]> wrote:
> On Wed, 04 Apr 2018 21:49:26 +0200
> Robert Jarzmik <[email protected]> wrote:
>
>> Ulf Hansson <[email protected]> writes:
>>
>> > On 2 April 2018 at 16:26, Robert Jarzmik <[email protected]> wrote:
>> >> Hi,
>> >>
>> >> This serie is aimed at removing the dmaengine slave compat use, and transfer
>> >> knowledge of the DMA requestors into architecture code.
>> >> As this looks like a patch bomb, each maintainer expressing for his tree either
>> >> an Ack or "I want to take through my tree" will be spared in the next iterations
>> >> of this serie.
>> >
>> > Perhaps an option is to send this hole series as PR for 3.17 rc1, that
>> > would removed some churns and make this faster/easier? Well, if you
>> > receive the needed acks of course.
>> For 3.17-rc1 it looks a bit optimistic with the review time ... If I have all
>
> Especially since 3.17-rc1 has been released more than 3 years ago :-),
> but I guess you meant 4.17-rc1.

Yeah, I realize that I was a bit lost in time yesterday. Even more
people have been having fun about it (me too). :-)

Kind regards
Uffe

2018-04-05 06:51:31

by Arnd Bergmann

[permalink] [raw]
Subject: Re: [PATCH 00/15] ARM: pxa: switch to DMA slave maps

On Thu, Apr 5, 2018 at 8:29 AM, Ulf Hansson <[email protected]> wrote:
> On 4 April 2018 at 21:56, Boris Brezillon <[email protected]> wrote:
>> On Wed, 04 Apr 2018 21:49:26 +0200
>> Robert Jarzmik <[email protected]> wrote:
>>
>>> Ulf Hansson <[email protected]> writes:
>>>
>>> > On 2 April 2018 at 16:26, Robert Jarzmik <[email protected]> wrote:
>>> >> Hi,
>>> >>
>>> >> This serie is aimed at removing the dmaengine slave compat use, and transfer
>>> >> knowledge of the DMA requestors into architecture code.
>>> >> As this looks like a patch bomb, each maintainer expressing for his tree either
>>> >> an Ack or "I want to take through my tree" will be spared in the next iterations
>>> >> of this serie.
>>> >
>>> > Perhaps an option is to send this hole series as PR for 3.17 rc1, that
>>> > would removed some churns and make this faster/easier? Well, if you
>>> > receive the needed acks of course.
>>> For 3.17-rc1 it looks a bit optimistic with the review time ... If I have all
>>
>> Especially since 3.17-rc1 has been released more than 3 years ago :-),
>> but I guess you meant 4.17-rc1.
>
> Yeah, I realize that I was a bit lost in time yesterday. Even more
> people have been having fun about it (me too). :-)

I occasionally still type 2.6.17 when I mean 4.17.

Arnd

2018-04-05 06:52:46

by Robert Jarzmik

[permalink] [raw]
Subject: Re: [PATCH 14/15] ARM: pxa: change SSP devices allocation

Arnd Bergmann <[email protected]> writes:

> I'm still unable to follow through that code, but I understand now that
> the device you pass to dma_request_slave_channel() is not the one
> we'd like it to be here.
>
> Where exactly does that call to dma_request_chan() happen? Is this
> the one in dmaengine_pcm_new()? Could we perhaps put a
> pointer to the SSP device into snd_dmaengine_dai_dma_data?
This is a sample stack I captured with an added WARN_ON(1), triggered by a
userland "aplay Sultans_Of_Swing.wav" :)

[ 299.216743] [<c0012e80>] (unwind_backtrace) from [<c000f55c>] (show_stack+0x20/0x24)
[ 299.223986] [<c000f55c>] (show_stack) from [<c0529d68>] (dump_stack+0x20/0x28)
[ 299.231321] [<c0529d68>] (dump_stack) from [<c001de34>] (__warn+0xf0/0x11c)
[ 299.238183] [<c001de34>] (__warn) from [<c001df94>] (warn_slowpath_null+0x4c/0x58)
[ 299.245234] [<c001df94>] (warn_slowpath_null) from [<c02a2d38>] (dma_request_chan+0x40/0x228)
[ 299.252550] [<c02a2d38>] (dma_request_chan) from [<c02a2f38>] (dma_request_slave_channel+0x18/0x24)
[ 299.259855] [<c02a2f38>] (dma_request_slave_channel) from [<c03f76f0>] (__pxa2xx_pcm_open+0xf4/0x110)
[ 299.266789] [<c03f76f0>] (__pxa2xx_pcm_open) from [<c0409ed0>] (soc_pcm_open+0xf8/0x9c8)
[ 299.273932] [<c0409ed0>] (soc_pcm_open) from [<c03db9d4>] (snd_pcm_open_substream+0x9c/0x134)
[ 299.281290] [<c03db9d4>] (snd_pcm_open_substream) from [<c03dbb28>] (snd_pcm_open+0xbc/0x22c)
[ 299.288255] [<c03dbb28>] (snd_pcm_open) from [<c03dbd58>] (snd_pcm_playback_open+0x50/0x88)
[ 299.295468] [<c03dbd58>] (snd_pcm_playback_open) from [<c03c9708>] (snd_open+0x124/0x144)
[ 299.302897] [<c03c9708>] (snd_open) from [<c0117de4>] (chrdev_open+0x1a0/0x1f0)
[ 299.310296] [<c0117de4>] (chrdev_open) from [<c010f4cc>] (do_dentry_open.constprop.0+0x1d4/0x31c)
[ 299.317345] [<c010f4cc>] (do_dentry_open.constprop.0) from [<c011061c>] (vfs_open+0x7c/0x80)
[ 299.324597] [<c011061c>] (vfs_open) from [<c0123080>] (path_openat+0xbe8/0xf90)
[ 299.332003] [<c0123080>] (path_openat) from [<c0124240>] (do_filp_open+0x80/0xe4)
[ 299.339044] [<c0124240>] (do_filp_open) from [<c0110a08>] (do_sys_open+0x148/0x1f8)
[ 299.346225] [<c0110a08>] (do_sys_open) from [<c0110ae4>] (SyS_open+0x2c/0x30)
[ 299.353505] [<c0110ae4>] (SyS_open) from [<c0009000>] (ret_fast_syscall+0x0/0x28)

Cheers.

--
Robert

2018-04-05 07:30:50

by Arnd Bergmann

[permalink] [raw]
Subject: Re: [PATCH 14/15] ARM: pxa: change SSP devices allocation

On Thu, Apr 5, 2018 at 8:51 AM, Robert Jarzmik <[email protected]> wrote:
> Arnd Bergmann <[email protected]> writes:
>
>> I'm still unable to follow through that code, but I understand now that
>> the device you pass to dma_request_slave_channel() is not the one
>> we'd like it to be here.
>>
>> Where exactly does that call to dma_request_chan() happen? Is this
>> the one in dmaengine_pcm_new()? Could we perhaps put a
>> pointer to the SSP device into snd_dmaengine_dai_dma_data?
> This is a sample stack I captured with an added WARN_ON(1), triggered by a
> userland "aplay Sultans_Of_Swing.wav" :)
>
> [ 299.216743] [<c0012e80>] (unwind_backtrace) from [<c000f55c>] (show_stack+0x20/0x24)
> [ 299.223986] [<c000f55c>] (show_stack) from [<c0529d68>] (dump_stack+0x20/0x28)
> [ 299.231321] [<c0529d68>] (dump_stack) from [<c001de34>] (__warn+0xf0/0x11c)
> [ 299.238183] [<c001de34>] (__warn) from [<c001df94>] (warn_slowpath_null+0x4c/0x58)
> [ 299.245234] [<c001df94>] (warn_slowpath_null) from [<c02a2d38>] (dma_request_chan+0x40/0x228)
> [ 299.252550] [<c02a2d38>] (dma_request_chan) from [<c02a2f38>] (dma_request_slave_channel+0x18/0x24)
> [ 299.259855] [<c02a2f38>] (dma_request_slave_channel) from [<c03f76f0>] (__pxa2xx_pcm_open+0xf4/0x110)
> [ 299.266789] [<c03f76f0>] (__pxa2xx_pcm_open) from [<c0409ed0>] (soc_pcm_open+0xf8/0x9c8)
> [ 299.273932] [<c0409ed0>] (soc_pcm_open) from [<c03db9d4>] (snd_pcm_open_substream+0x9c/0x134)

Ok, so it seems we currently have a special case here that is only used by
pxa/mmp and omap, and you can simply open-code that by calling
dma_request_chan() from the pxa-specific __pxa2xx_pcm_open()
with any device pointer you like, it doesn't have to be the main audio
device.

I don't know exactly how the probing works, but I'd assume that we have
the correct device pointers in pxa2xx_ac97_dev_probe() and
asoc_ssp_probe(), or maybe in pxa2xx_ac97_*_startup() and
pxa_ssp_startup().

Arnd

2018-04-08 13:02:02

by Robert Jarzmik

[permalink] [raw]
Subject: Re: [PATCH 14/15] ARM: pxa: change SSP devices allocation

Arnd Bergmann <[email protected]> writes:

> I don't know exactly how the probing works, but I'd assume that we have
> the correct device pointers in pxa2xx_ac97_dev_probe() and
> asoc_ssp_probe(), or maybe in pxa2xx_ac97_*_startup() and
> pxa_ssp_startup().

Yes, let's try this way, in the former patch

"ASoC: pxa: remove the dmaengine compat need" :
+++ b/sound/arm/pxa2xx-pcm-lib.c
@@ -126,7 +127,7 @@ int __pxa2xx_pcm_open(struct snd_pcm_substream *substream)
return ret;

return snd_dmaengine_pcm_open(
- substream, dma_request_slave_channel(rtd->platform->dev,
+ substream, dma_request_slave_channel(rtd->cpu_dai->dev,
dma_params->chan_name));
}

The cpu_dai device should be either pxa27x_ac97 or pxa-ssp-dai.<Id>, and amend
the dma slave map accordingly.

Cheers.

--
Robert

2018-04-12 15:32:25

by Mark Brown

[permalink] [raw]
Subject: Re: [PATCH 08/15] ASoC: pxa: remove the dmaengine compat need

On Mon, Apr 02, 2018 at 04:26:49PM +0200, Robert Jarzmik wrote:
> As the pxa architecture switched towards the dmaengine slave map, the
> old compatibility mechanism to acquire the dma requestor line number and
> priority are not needed anymore.

Acked-by: Mark Brown <[email protected]>

If there's no dependency I'm happy to take this for 4.18.


Attachments:
(No filename) (356.00 B)
signature.asc (499.00 B)
Download all attachments

2018-04-12 16:58:14

by Robert Jarzmik

[permalink] [raw]
Subject: Re: [PATCH 08/15] ASoC: pxa: remove the dmaengine compat need

Mark Brown <[email protected]> writes:

> On Mon, Apr 02, 2018 at 04:26:49PM +0200, Robert Jarzmik wrote:
>> As the pxa architecture switched towards the dmaengine slave map, the
>> old compatibility mechanism to acquire the dma requestor line number and
>> priority are not needed anymore.
>
> Acked-by: Mark Brown <[email protected]>
>
> If there's no dependency I'm happy to take this for 4.18.
Thanks for the ack.

The patches 1 and 2 are the dependency here, so I'd rather push it through my
tree once the review is complete.

Cheers.

--
Robert

2018-04-21 19:31:41

by Robert Jarzmik

[permalink] [raw]
Subject: Re: [PATCH 04/15] media: pxa_camera: remove the dmaengine compat need

Robert Jarzmik <[email protected]> writes:

> From: Robert Jarzmik <[email protected]>
>
> As the pxa architecture switched towards the dmaengine slave map, the
> old compatibility mechanism to acquire the dma requestor line number and
> priority are not needed anymore.
>
> This patch simplifies the dma resource acquisition, using the more
> generic function dma_request_slave_channel().
>
> Signed-off-by: Robert Jarzmik <[email protected]>
> ---
> drivers/media/platform/pxa_camera.c | 22 +++-------------------
> 1 file changed, 3 insertions(+), 19 deletions(-)
Hans, could I have your ack please ?

Cheers.

--
Robert

PS: The submitted patch
>
> diff --git a/drivers/media/platform/pxa_camera.c b/drivers/media/platform/pxa_camera.c
> index c71a00736541..4c82d1880753 100644
> --- a/drivers/media/platform/pxa_camera.c
> +++ b/drivers/media/platform/pxa_camera.c
> @@ -2357,8 +2357,6 @@ static int pxa_camera_probe(struct platform_device *pdev)
> .src_maxburst = 8,
> .direction = DMA_DEV_TO_MEM,
> };
> - dma_cap_mask_t mask;
> - struct pxad_param params;
> char clk_name[V4L2_CLK_NAME_SIZE];
> int irq;
> int err = 0, i;
> @@ -2432,34 +2430,20 @@ static int pxa_camera_probe(struct platform_device *pdev)
> pcdev->base = base;
>
> /* request dma */
> - dma_cap_zero(mask);
> - dma_cap_set(DMA_SLAVE, mask);
> - dma_cap_set(DMA_PRIVATE, mask);
> -
> - params.prio = 0;
> - params.drcmr = 68;
> - pcdev->dma_chans[0] =
> - dma_request_slave_channel_compat(mask, pxad_filter_fn,
> - &params, &pdev->dev, "CI_Y");
> + pcdev->dma_chans[0] = dma_request_slave_channel(&pdev->dev, "CI_Y");
> if (!pcdev->dma_chans[0]) {
> dev_err(&pdev->dev, "Can't request DMA for Y\n");
> return -ENODEV;
> }
>
> - params.drcmr = 69;
> - pcdev->dma_chans[1] =
> - dma_request_slave_channel_compat(mask, pxad_filter_fn,
> - &params, &pdev->dev, "CI_U");
> + pcdev->dma_chans[1] = dma_request_slave_channel(&pdev->dev, "CI_U");
> if (!pcdev->dma_chans[1]) {
> dev_err(&pdev->dev, "Can't request DMA for Y\n");
> err = -ENODEV;
> goto exit_free_dma_y;
> }
>
> - params.drcmr = 70;
> - pcdev->dma_chans[2] =
> - dma_request_slave_channel_compat(mask, pxad_filter_fn,
> - &params, &pdev->dev, "CI_V");
> + pcdev->dma_chans[2] = dma_request_slave_channel(&pdev->dev, "CI_V");
> if (!pcdev->dma_chans[2]) {
> dev_err(&pdev->dev, "Can't request DMA for V\n");
> err = -ENODEV;

2018-04-21 19:32:49

by Robert Jarzmik

[permalink] [raw]
Subject: Re: [PATCH 09/15] net: irda: pxaficp_ir: remove the dmaengine compat need

Robert Jarzmik <[email protected]> writes:

> As the pxa architecture switched towards the dmaengine slave map, the
> old compatibility mechanism to acquire the dma requestor line number and
> priority are not needed anymore.
>
> This patch simplifies the dma resource acquisition, using the more
> generic function dma_request_slave_channel().
>
> Signed-off-by: Robert Jarzmik <[email protected]>
Samuel, could I have your ack please ?

Cheers.

--
Robert

PS: The submitted patch
> ---
> drivers/staging/irda/drivers/pxaficp_ir.c | 14 ++------------
> 1 file changed, 2 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/staging/irda/drivers/pxaficp_ir.c b/drivers/staging/irda/drivers/pxaficp_ir.c
> index 2ea00a6531f9..9dd6e21dc11e 100644
> --- a/drivers/staging/irda/drivers/pxaficp_ir.c
> +++ b/drivers/staging/irda/drivers/pxaficp_ir.c
> @@ -20,7 +20,6 @@
> #include <linux/clk.h>
> #include <linux/dmaengine.h>
> #include <linux/dma-mapping.h>
> -#include <linux/dma/pxa-dma.h>
> #include <linux/gpio.h>
> #include <linux/slab.h>
> #include <linux/sched/clock.h>
> @@ -735,9 +734,7 @@ static void pxa_irda_shutdown(struct pxa_irda *si)
> static int pxa_irda_start(struct net_device *dev)
> {
> struct pxa_irda *si = netdev_priv(dev);
> - dma_cap_mask_t mask;
> struct dma_slave_config config;
> - struct pxad_param param;
> int err;
>
> si->speed = 9600;
> @@ -757,9 +754,6 @@ static int pxa_irda_start(struct net_device *dev)
> disable_irq(si->icp_irq);
>
> err = -EBUSY;
> - dma_cap_zero(mask);
> - dma_cap_set(DMA_SLAVE, mask);
> - param.prio = PXAD_PRIO_LOWEST;
>
> memset(&config, 0, sizeof(config));
> config.src_addr_width = DMA_SLAVE_BUSWIDTH_1_BYTE;
> @@ -769,15 +763,11 @@ static int pxa_irda_start(struct net_device *dev)
> config.src_maxburst = 32;
> config.dst_maxburst = 32;
>
> - param.drcmr = si->drcmr_rx;
> - si->rxdma = dma_request_slave_channel_compat(mask, pxad_filter_fn,
> - &param, &dev->dev, "rx");
> + si->rxdma = dma_request_slave_channel(&dev->dev, "rx");
> if (!si->rxdma)
> goto err_rx_dma;
>
> - param.drcmr = si->drcmr_tx;
> - si->txdma = dma_request_slave_channel_compat(mask, pxad_filter_fn,
> - &param, &dev->dev, "tx");
> + si->txdma = dma_request_slave_channel(&dev->dev, "tx");
> if (!si->txdma)
> goto err_tx_dma;

2018-04-21 19:34:05

by Robert Jarzmik

[permalink] [raw]
Subject: Re: [PATCH 10/15] ata: pata_pxa: remove the dmaengine compat need

Robert Jarzmik <[email protected]> writes:

> As the pxa architecture switched towards the dmaengine slave map, the
> old compatibility mechanism to acquire the dma requestor line number and
> priority are not needed anymore.
>
> This patch simplifies the dma resource acquisition, using the more
> generic function dma_request_slave_channel().
>
> Signed-off-by: Robert Jarzmik <[email protected]>

Bartlomiej, could I have your ack please ?

Cheers.

--
Robert

PS: The submitted patch
> ---
> drivers/ata/pata_pxa.c | 10 +---------
> 1 file changed, 1 insertion(+), 9 deletions(-)
>
> diff --git a/drivers/ata/pata_pxa.c b/drivers/ata/pata_pxa.c
> index f6c46e9a4dc0..e8b6a2e464c9 100644
> --- a/drivers/ata/pata_pxa.c
> +++ b/drivers/ata/pata_pxa.c
> @@ -25,7 +25,6 @@
> #include <linux/libata.h>
> #include <linux/platform_device.h>
> #include <linux/dmaengine.h>
> -#include <linux/dma/pxa-dma.h>
> #include <linux/gpio.h>
> #include <linux/slab.h>
> #include <linux/completion.h>
> @@ -180,8 +179,6 @@ static int pxa_ata_probe(struct platform_device *pdev)
> struct resource *irq_res;
> struct pata_pxa_pdata *pdata = dev_get_platdata(&pdev->dev);
> struct dma_slave_config config;
> - dma_cap_mask_t mask;
> - struct pxad_param param;
> int ret = 0;
>
> /*
> @@ -278,10 +275,6 @@ static int pxa_ata_probe(struct platform_device *pdev)
>
> ap->private_data = data;
>
> - dma_cap_zero(mask);
> - dma_cap_set(DMA_SLAVE, mask);
> - param.prio = PXAD_PRIO_LOWEST;
> - param.drcmr = pdata->dma_dreq;
> memset(&config, 0, sizeof(config));
> config.src_addr_width = DMA_SLAVE_BUSWIDTH_2_BYTES;
> config.dst_addr_width = DMA_SLAVE_BUSWIDTH_2_BYTES;
> @@ -294,8 +287,7 @@ static int pxa_ata_probe(struct platform_device *pdev)
> * Request the DMA channel
> */
> data->dma_chan =
> - dma_request_slave_channel_compat(mask, pxad_filter_fn,
> - &param, &pdev->dev, "data");
> + dma_request_slave_channel(&pdev->dev, "data");
> if (!data->dma_chan)
> return -EBUSY;
> ret = dmaengine_slave_config(data->dma_chan, &config);

2018-04-22 06:14:01

by Vinod Koul

[permalink] [raw]
Subject: Re: [PATCH 01/15] dmaengine: pxa: use a dma slave map

On Sat, Apr 21, 2018 at 09:23:05PM +0200, Robert Jarzmik wrote:
> Robert Jarzmik <[email protected]> writes:
>
> > In order to remove the specific knowledge of the dma mapping from PXA
> > drivers, add a default slave map for pxa architectures.
> >
> > This won't impact MMP architecture, but is aimed only at all PXA boards.
> >
> > This is the first step, and once all drivers are converted,
> > pxad_filter_fn() will be made static, and the DMA resources removed from
> > device.c.
> >
> > Signed-off-by: Robert Jarzmik <[email protected]>
> > Reported-by: Arnd Bergmann <[email protected]>
>
> Vinod, could I have your ack please ?

Sure thing:

Acked-By: Vinod Koul <[email protected]>

--
~Vinod

2018-04-22 11:08:01

by Hans Verkuil

[permalink] [raw]
Subject: Re: [PATCH 04/15] media: pxa_camera: remove the dmaengine compat need

On 04/21/2018 09:27 PM, Robert Jarzmik wrote:
> Robert Jarzmik <[email protected]> writes:
>
>> From: Robert Jarzmik <[email protected]>
>>
>> As the pxa architecture switched towards the dmaengine slave map, the
>> old compatibility mechanism to acquire the dma requestor line number and
>> priority are not needed anymore.
>>
>> This patch simplifies the dma resource acquisition, using the more
>> generic function dma_request_slave_channel().
>>
>> Signed-off-by: Robert Jarzmik <[email protected]>
>> ---
>> drivers/media/platform/pxa_camera.c | 22 +++-------------------
>> 1 file changed, 3 insertions(+), 19 deletions(-)
> Hans, could I have your ack please ?

Done.

Hans

>
> Cheers.
>
> --
> Robert
>
> PS: The submitted patch
>>
>> diff --git a/drivers/media/platform/pxa_camera.c b/drivers/media/platform/pxa_camera.c
>> index c71a00736541..4c82d1880753 100644
>> --- a/drivers/media/platform/pxa_camera.c
>> +++ b/drivers/media/platform/pxa_camera.c
>> @@ -2357,8 +2357,6 @@ static int pxa_camera_probe(struct platform_device *pdev)
>> .src_maxburst = 8,
>> .direction = DMA_DEV_TO_MEM,
>> };
>> - dma_cap_mask_t mask;
>> - struct pxad_param params;
>> char clk_name[V4L2_CLK_NAME_SIZE];
>> int irq;
>> int err = 0, i;
>> @@ -2432,34 +2430,20 @@ static int pxa_camera_probe(struct platform_device *pdev)
>> pcdev->base = base;
>>
>> /* request dma */
>> - dma_cap_zero(mask);
>> - dma_cap_set(DMA_SLAVE, mask);
>> - dma_cap_set(DMA_PRIVATE, mask);
>> -
>> - params.prio = 0;
>> - params.drcmr = 68;
>> - pcdev->dma_chans[0] =
>> - dma_request_slave_channel_compat(mask, pxad_filter_fn,
>> - &params, &pdev->dev, "CI_Y");
>> + pcdev->dma_chans[0] = dma_request_slave_channel(&pdev->dev, "CI_Y");
>> if (!pcdev->dma_chans[0]) {
>> dev_err(&pdev->dev, "Can't request DMA for Y\n");
>> return -ENODEV;
>> }
>>
>> - params.drcmr = 69;
>> - pcdev->dma_chans[1] =
>> - dma_request_slave_channel_compat(mask, pxad_filter_fn,
>> - &params, &pdev->dev, "CI_U");
>> + pcdev->dma_chans[1] = dma_request_slave_channel(&pdev->dev, "CI_U");
>> if (!pcdev->dma_chans[1]) {
>> dev_err(&pdev->dev, "Can't request DMA for Y\n");
>> err = -ENODEV;
>> goto exit_free_dma_y;
>> }
>>
>> - params.drcmr = 70;
>> - pcdev->dma_chans[2] =
>> - dma_request_slave_channel_compat(mask, pxad_filter_fn,
>> - &params, &pdev->dev, "CI_V");
>> + pcdev->dma_chans[2] = dma_request_slave_channel(&pdev->dev, "CI_V");
>> if (!pcdev->dma_chans[2]) {
>> dev_err(&pdev->dev, "Can't request DMA for V\n");
>> err = -ENODEV;


2018-04-22 11:08:31

by Hans Verkuil

[permalink] [raw]
Subject: Re: [PATCH 04/15] media: pxa_camera: remove the dmaengine compat need

On 04/02/2018 04:26 PM, Robert Jarzmik wrote:
> From: Robert Jarzmik <[email protected]>
>
> As the pxa architecture switched towards the dmaengine slave map, the
> old compatibility mechanism to acquire the dma requestor line number and
> priority are not needed anymore.
>
> This patch simplifies the dma resource acquisition, using the more
> generic function dma_request_slave_channel().
>
> Signed-off-by: Robert Jarzmik <[email protected]>

Acked-by: Hans Verkuil <[email protected]>

Regards,

Hans

> ---
> drivers/media/platform/pxa_camera.c | 22 +++-------------------
> 1 file changed, 3 insertions(+), 19 deletions(-)
>
> diff --git a/drivers/media/platform/pxa_camera.c b/drivers/media/platform/pxa_camera.c
> index c71a00736541..4c82d1880753 100644
> --- a/drivers/media/platform/pxa_camera.c
> +++ b/drivers/media/platform/pxa_camera.c
> @@ -2357,8 +2357,6 @@ static int pxa_camera_probe(struct platform_device *pdev)
> .src_maxburst = 8,
> .direction = DMA_DEV_TO_MEM,
> };
> - dma_cap_mask_t mask;
> - struct pxad_param params;
> char clk_name[V4L2_CLK_NAME_SIZE];
> int irq;
> int err = 0, i;
> @@ -2432,34 +2430,20 @@ static int pxa_camera_probe(struct platform_device *pdev)
> pcdev->base = base;
>
> /* request dma */
> - dma_cap_zero(mask);
> - dma_cap_set(DMA_SLAVE, mask);
> - dma_cap_set(DMA_PRIVATE, mask);
> -
> - params.prio = 0;
> - params.drcmr = 68;
> - pcdev->dma_chans[0] =
> - dma_request_slave_channel_compat(mask, pxad_filter_fn,
> - &params, &pdev->dev, "CI_Y");
> + pcdev->dma_chans[0] = dma_request_slave_channel(&pdev->dev, "CI_Y");
> if (!pcdev->dma_chans[0]) {
> dev_err(&pdev->dev, "Can't request DMA for Y\n");
> return -ENODEV;
> }
>
> - params.drcmr = 69;
> - pcdev->dma_chans[1] =
> - dma_request_slave_channel_compat(mask, pxad_filter_fn,
> - &params, &pdev->dev, "CI_U");
> + pcdev->dma_chans[1] = dma_request_slave_channel(&pdev->dev, "CI_U");
> if (!pcdev->dma_chans[1]) {
> dev_err(&pdev->dev, "Can't request DMA for Y\n");
> err = -ENODEV;
> goto exit_free_dma_y;
> }
>
> - params.drcmr = 70;
> - pcdev->dma_chans[2] =
> - dma_request_slave_channel_compat(mask, pxad_filter_fn,
> - &params, &pdev->dev, "CI_V");
> + pcdev->dma_chans[2] = dma_request_slave_channel(&pdev->dev, "CI_V");
> if (!pcdev->dma_chans[2]) {
> dev_err(&pdev->dev, "Can't request DMA for V\n");
> err = -ENODEV;
>


2018-04-23 08:39:17

by Greg KH

[permalink] [raw]
Subject: Re: [PATCH 09/15] net: irda: pxaficp_ir: remove the dmaengine compat need

On Mon, Apr 02, 2018 at 04:26:50PM +0200, Robert Jarzmik wrote:
> As the pxa architecture switched towards the dmaengine slave map, the
> old compatibility mechanism to acquire the dma requestor line number and
> priority are not needed anymore.
>
> This patch simplifies the dma resource acquisition, using the more
> generic function dma_request_slave_channel().
>
> Signed-off-by: Robert Jarzmik <[email protected]>
> ---
> drivers/staging/irda/drivers/pxaficp_ir.c | 14 ++------------
> 1 file changed, 2 insertions(+), 12 deletions(-)

This file is no longer in Linus's tree :)

thanks,

greg k-h

Subject: Re: [PATCH 10/15] ata: pata_pxa: remove the dmaengine compat need

On Saturday, April 21, 2018 09:32:11 PM Robert Jarzmik wrote:
> Robert Jarzmik <[email protected]> writes:
>
> > As the pxa architecture switched towards the dmaengine slave map, the
> > old compatibility mechanism to acquire the dma requestor line number and
> > priority are not needed anymore.
> >
> > This patch simplifies the dma resource acquisition, using the more
> > generic function dma_request_slave_channel().
> >
> > Signed-off-by: Robert Jarzmik <[email protected]>
>
> Bartlomiej, could I have your ack please ?

Sure.

Acked-by: Bartlomiej Zolnierkiewicz <[email protected]>

Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics


2018-05-04 19:32:16

by Mauro Carvalho Chehab

[permalink] [raw]
Subject: Re: [PATCH 04/15] media: pxa_camera: remove the dmaengine compat need

Em Sun, 22 Apr 2018 13:06:12 +0200
Hans Verkuil <[email protected]> escreveu:

> On 04/02/2018 04:26 PM, Robert Jarzmik wrote:
> > From: Robert Jarzmik <[email protected]>
> >
> > As the pxa architecture switched towards the dmaengine slave map, the
> > old compatibility mechanism to acquire the dma requestor line number and
> > priority are not needed anymore.
> >
> > This patch simplifies the dma resource acquisition, using the more
> > generic function dma_request_slave_channel().
> >
> > Signed-off-by: Robert Jarzmik <[email protected]>
>
> Acked-by: Hans Verkuil <[email protected]>

I'm assuming that you'll be applying it together with other PXA patches.
So:

Acked-by: Mauro Carvalho Chehab <[email protected]>

Regards,
Mauro
>
> Regards,
>
> Hans
>
> > ---
> > drivers/media/platform/pxa_camera.c | 22 +++-------------------
> > 1 file changed, 3 insertions(+), 19 deletions(-)
> >
> > diff --git a/drivers/media/platform/pxa_camera.c b/drivers/media/platform/pxa_camera.c
> > index c71a00736541..4c82d1880753 100644
> > --- a/drivers/media/platform/pxa_camera.c
> > +++ b/drivers/media/platform/pxa_camera.c
> > @@ -2357,8 +2357,6 @@ static int pxa_camera_probe(struct platform_device *pdev)
> > .src_maxburst = 8,
> > .direction = DMA_DEV_TO_MEM,
> > };
> > - dma_cap_mask_t mask;
> > - struct pxad_param params;
> > char clk_name[V4L2_CLK_NAME_SIZE];
> > int irq;
> > int err = 0, i;
> > @@ -2432,34 +2430,20 @@ static int pxa_camera_probe(struct platform_device *pdev)
> > pcdev->base = base;
> >
> > /* request dma */
> > - dma_cap_zero(mask);
> > - dma_cap_set(DMA_SLAVE, mask);
> > - dma_cap_set(DMA_PRIVATE, mask);
> > -
> > - params.prio = 0;
> > - params.drcmr = 68;
> > - pcdev->dma_chans[0] =
> > - dma_request_slave_channel_compat(mask, pxad_filter_fn,
> > - &params, &pdev->dev, "CI_Y");
> > + pcdev->dma_chans[0] = dma_request_slave_channel(&pdev->dev, "CI_Y");
> > if (!pcdev->dma_chans[0]) {
> > dev_err(&pdev->dev, "Can't request DMA for Y\n");
> > return -ENODEV;
> > }
> >
> > - params.drcmr = 69;
> > - pcdev->dma_chans[1] =
> > - dma_request_slave_channel_compat(mask, pxad_filter_fn,
> > - &params, &pdev->dev, "CI_U");
> > + pcdev->dma_chans[1] = dma_request_slave_channel(&pdev->dev, "CI_U");
> > if (!pcdev->dma_chans[1]) {
> > dev_err(&pdev->dev, "Can't request DMA for Y\n");
> > err = -ENODEV;
> > goto exit_free_dma_y;
> > }
> >
> > - params.drcmr = 70;
> > - pcdev->dma_chans[2] =
> > - dma_request_slave_channel_compat(mask, pxad_filter_fn,
> > - &params, &pdev->dev, "CI_V");
> > + pcdev->dma_chans[2] = dma_request_slave_channel(&pdev->dev, "CI_V");
> > if (!pcdev->dma_chans[2]) {
> > dev_err(&pdev->dev, "Can't request DMA for V\n");
> > err = -ENODEV;
> >
>



Thanks,
Mauro

2018-05-18 21:39:34

by Daniel Mack

[permalink] [raw]
Subject: Re: [PATCH 05/15] mtd: nand: pxa3xx: remove the dmaengine compat need

Hi Robert,

Thanks for this series.

On Monday, April 02, 2018 04:26 PM, Robert Jarzmik wrote:
> From: Robert Jarzmik <[email protected]>
>
> As the pxa architecture switched towards the dmaengine slave map, the
> old compatibility mechanism to acquire the dma requestor line number and
> priority are not needed anymore.
>
> This patch simplifies the dma resource acquisition, using the more
> generic function dma_request_slave_channel().
>
> Signed-off-by: Robert Jarzmik <[email protected]>
> ---
> drivers/mtd/nand/pxa3xx_nand.c | 10 +---------

This driver was replaced by drivers/mtd/nand/raw/marvell_nand.c
recently, so this patch can be dropped. I attached a version for the new
driver which you can pick instead.


Thanks,
Daniel


Attachments:
0001-mtd-rawnand-marvell-remove-dmaengine-compat-code.patch (1.64 kB)

2018-05-23 21:55:24

by Daniel Mack

[permalink] [raw]
Subject: Re: [PATCH 05/15] mtd: nand: pxa3xx: remove the dmaengine compat need

Hi Robert,

Please refer to the attached patch instead of the one I sent earlier. I
missed to also remove the platform_get_resource(IORESOURCE_DMA) call.


Thanks,
Daniel


On Friday, May 18, 2018 11:31 PM, Daniel Mack wrote:
> Hi Robert,
>
> Thanks for this series.
>
> On Monday, April 02, 2018 04:26 PM, Robert Jarzmik wrote:
>> From: Robert Jarzmik <[email protected]>
>>
>> As the pxa architecture switched towards the dmaengine slave map, the
>> old compatibility mechanism to acquire the dma requestor line number and
>> priority are not needed anymore.
>>
>> This patch simplifies the dma resource acquisition, using the more
>> generic function dma_request_slave_channel().
>>
>> Signed-off-by: Robert Jarzmik <[email protected]>
>> ---
>> drivers/mtd/nand/pxa3xx_nand.c | 10 +---------
>
> This driver was replaced by drivers/mtd/nand/raw/marvell_nand.c
> recently, so this patch can be dropped. I attached a version for the new
> driver which you can pick instead.
>
>
> Thanks,
> Daniel
>


Attachments:
0001-mtd-rawnand-marvell-remove-dmaengine-compat-code.patch (1.80 kB)