소스 검색

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 <robert.jarzmik@free.fr>
Reported-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Vinod Koul <vkoul@kernel.org>
Robert Jarzmik 7 년 전
부모
커밋
420c0117db
2개의 변경된 파일13개의 추가작업 그리고 1개의 파일을 삭제
  1. 9 1
      drivers/dma/pxa_dma.c
  2. 4 0
      include/linux/platform_data/mmp_dma.h

+ 9 - 1
drivers/dma/pxa_dma.c

@@ -179,6 +179,8 @@ static unsigned int pxad_drcmr(unsigned int line)
 	return 0x1000 + line * 4;
 	return 0x1000 + line * 4;
 }
 }
 
 
+bool pxad_filter_fn(struct dma_chan *chan, void *param);
+
 /*
 /*
  * Debug fs
  * Debug fs
  */
  */
@@ -1396,9 +1398,10 @@ static int pxad_probe(struct platform_device *op)
 {
 {
 	struct pxad_device *pdev;
 	struct pxad_device *pdev;
 	const struct of_device_id *of_id;
 	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 mmp_dma_platdata *pdata = dev_get_platdata(&op->dev);
 	struct resource *iores;
 	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 =
 	const enum dma_slave_buswidth widths =
 		DMA_SLAVE_BUSWIDTH_1_BYTE   | DMA_SLAVE_BUSWIDTH_2_BYTES |
 		DMA_SLAVE_BUSWIDTH_1_BYTE   | DMA_SLAVE_BUSWIDTH_2_BYTES |
 		DMA_SLAVE_BUSWIDTH_4_BYTES;
 		DMA_SLAVE_BUSWIDTH_4_BYTES;
@@ -1429,6 +1432,8 @@ static int pxad_probe(struct platform_device *op)
 	} else if (pdata && pdata->dma_channels) {
 	} else if (pdata && pdata->dma_channels) {
 		dma_channels = pdata->dma_channels;
 		dma_channels = pdata->dma_channels;
 		nb_requestors = pdata->nb_requestors;
 		nb_requestors = pdata->nb_requestors;
+		slave_map = pdata->slave_map;
+		slave_map_cnt = pdata->slave_map_cnt;
 	} else {
 	} else {
 		dma_channels = 32;	/* default 32 channel */
 		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_dma_memcpy = pxad_prep_memcpy;
 	pdev->slave.device_prep_slave_sg = pxad_prep_slave_sg;
 	pdev->slave.device_prep_slave_sg = pxad_prep_slave_sg;
 	pdev->slave.device_prep_dma_cyclic = pxad_prep_dma_cyclic;
 	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.copy_align = PDMA_ALIGNMENT;
 	pdev->slave.src_addr_widths = widths;
 	pdev->slave.src_addr_widths = widths;

+ 4 - 0
include/linux/platform_data/mmp_dma.h

@@ -12,9 +12,13 @@
 #ifndef MMP_DMA_H
 #ifndef MMP_DMA_H
 #define MMP_DMA_H
 #define MMP_DMA_H
 
 
+struct dma_slave_map;
+
 struct mmp_dma_platdata {
 struct mmp_dma_platdata {
 	int dma_channels;
 	int dma_channels;
 	int nb_requestors;
 	int nb_requestors;
+	int slave_map_cnt;
+	const struct dma_slave_map *slave_map;
 };
 };
 
 
 #endif /* MMP_DMA_H */
 #endif /* MMP_DMA_H */