Commit 77a68e56 authored by Maxime Ripard's avatar Maxime Ripard Committed by Vinod Koul
Browse files

dmaengine: Add an enum for the dmaengine alignment constraints



Most drivers need to set constraints on the buffer alignment for async tx
operations. However, even though it is documented, some drivers either use
a defined constant that is not matching what the alignment variable expects
(like DMA_BUSWIDTH_* constants) or fill the alignment in bytes instead of
power of two.

Add a new enum for these alignments that matches what the framework
expects, and convert the drivers to it.

Signed-off-by: default avatarMaxime Ripard <maxime.ripard@free-electrons.com>
Signed-off-by: default avatarVinod Koul <vinod.koul@intel.com>
parent 056f6c87
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -2730,7 +2730,7 @@ static int __init coh901318_probe(struct platform_device *pdev)
	 * This controller can only access address at even 32bit boundaries,
	 * i.e. 2^2
	 */
	base->dma_memcpy.copy_align = 2;
	base->dma_memcpy.copy_align = DMAENGINE_ALIGN_4_BYTES;
	err = dma_async_device_register(&base->dma_memcpy);

	if (err)
+1 −1
Original line number Diff line number Diff line
@@ -775,7 +775,7 @@ static int jz4780_dma_probe(struct platform_device *pdev)
	dma_cap_set(DMA_CYCLIC, dd->cap_mask);

	dd->dev = dev;
	dd->copy_align = 2; /* 2^2 = 4 byte alignment */
	dd->copy_align = DMAENGINE_ALIGN_4_BYTES;
	dd->device_alloc_chan_resources = jz4780_dma_alloc_chan_resources;
	dd->device_free_chan_resources = jz4780_dma_free_chan_resources;
	dd->device_prep_slave_sg = jz4780_dma_prep_slave_sg;
+1 −1
Original line number Diff line number Diff line
@@ -1000,7 +1000,7 @@ static void edma_dma_init(struct edma_cc *ecc, struct dma_device *dma,
	 * code using dma memcpy must make sure alignment of
	 * length is at dma->copy_align boundary.
	 */
	dma->copy_align = DMA_SLAVE_BUSWIDTH_4_BYTES;
	dma->copy_align = DMAENGINE_ALIGN_4_BYTES;

	INIT_LIST_HEAD(&dma->channels);
}
+1 −1
Original line number Diff line number Diff line
@@ -1187,7 +1187,7 @@ static int __init imxdma_probe(struct platform_device *pdev)

	platform_set_drvdata(pdev, imxdma);

	imxdma->dma_device.copy_align = 2; /* 2^2 = 4 bytes alignment */
	imxdma->dma_device.copy_align = DMAENGINE_ALIGN_4_BYTES;
	imxdma->dma_device.dev->dma_parms = &imxdma->dma_parms;
	dma_set_max_seg_size(imxdma->dma_device.dev, 0xffffff);

+1 −2
Original line number Diff line number Diff line
@@ -24,7 +24,6 @@
#include "virt-dma.h"

#define DRIVER_NAME		"k3-dma"
#define DMA_ALIGN		3
#define DMA_MAX_SIZE		0x1ffc

#define INT_STAT		0x00
@@ -732,7 +731,7 @@ static int k3_dma_probe(struct platform_device *op)
	d->slave.device_pause = k3_dma_transfer_pause;
	d->slave.device_resume = k3_dma_transfer_resume;
	d->slave.device_terminate_all = k3_dma_terminate_all;
	d->slave.copy_align = DMA_ALIGN;
	d->slave.copy_align = DMAENGINE_ALIGN_8_BYTES;

	/* init virtual channel */
	d->chans = devm_kzalloc(&op->dev,
Loading