aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/dma/coh901318.c2
-rw-r--r--drivers/dma/dma-jz4780.c2
-rw-r--r--drivers/dma/edma.c2
-rw-r--r--drivers/dma/imx-dma.c2
-rw-r--r--drivers/dma/k3dma.c3
-rw-r--r--drivers/dma/mic_x100_dma.h2
-rw-r--r--drivers/dma/mmp_pdma.c3
-rw-r--r--drivers/dma/mmp_tdma.c3
-rw-r--r--drivers/dma/ste_dma40.c2
-rw-r--r--drivers/dma/sun6i-dma.c2
-rw-r--r--drivers/dma/xgene-dma.c5
-rw-r--r--include/linux/dmaengine.h25
12 files changed, 32 insertions, 21 deletions
diff --git a/drivers/dma/coh901318.c b/drivers/dma/coh901318.c
index fd22dd36985f..c340ca9bd2b5 100644
--- a/drivers/dma/coh901318.c
+++ b/drivers/dma/coh901318.c
@@ -2730,7 +2730,7 @@ static int __init coh901318_probe(struct platform_device *pdev)
2730 * This controller can only access address at even 32bit boundaries, 2730 * This controller can only access address at even 32bit boundaries,
2731 * i.e. 2^2 2731 * i.e. 2^2
2732 */ 2732 */
2733 base->dma_memcpy.copy_align = 2; 2733 base->dma_memcpy.copy_align = DMAENGINE_ALIGN_4_BYTES;
2734 err = dma_async_device_register(&base->dma_memcpy); 2734 err = dma_async_device_register(&base->dma_memcpy);
2735 2735
2736 if (err) 2736 if (err)
diff --git a/drivers/dma/dma-jz4780.c b/drivers/dma/dma-jz4780.c
index 26d2f0e09ea3..c29569ac9e4f 100644
--- a/drivers/dma/dma-jz4780.c
+++ b/drivers/dma/dma-jz4780.c
@@ -775,7 +775,7 @@ static int jz4780_dma_probe(struct platform_device *pdev)
775 dma_cap_set(DMA_CYCLIC, dd->cap_mask); 775 dma_cap_set(DMA_CYCLIC, dd->cap_mask);
776 776
777 dd->dev = dev; 777 dd->dev = dev;
778 dd->copy_align = 2; /* 2^2 = 4 byte alignment */ 778 dd->copy_align = DMAENGINE_ALIGN_4_BYTES;
779 dd->device_alloc_chan_resources = jz4780_dma_alloc_chan_resources; 779 dd->device_alloc_chan_resources = jz4780_dma_alloc_chan_resources;
780 dd->device_free_chan_resources = jz4780_dma_free_chan_resources; 780 dd->device_free_chan_resources = jz4780_dma_free_chan_resources;
781 dd->device_prep_slave_sg = jz4780_dma_prep_slave_sg; 781 dd->device_prep_slave_sg = jz4780_dma_prep_slave_sg;
diff --git a/drivers/dma/edma.c b/drivers/dma/edma.c
index 88853af69489..3e5d4f193005 100644
--- a/drivers/dma/edma.c
+++ b/drivers/dma/edma.c
@@ -1000,7 +1000,7 @@ static void edma_dma_init(struct edma_cc *ecc, struct dma_device *dma,
1000 * code using dma memcpy must make sure alignment of 1000 * code using dma memcpy must make sure alignment of
1001 * length is at dma->copy_align boundary. 1001 * length is at dma->copy_align boundary.
1002 */ 1002 */
1003 dma->copy_align = DMA_SLAVE_BUSWIDTH_4_BYTES; 1003 dma->copy_align = DMAENGINE_ALIGN_4_BYTES;
1004 1004
1005 INIT_LIST_HEAD(&dma->channels); 1005 INIT_LIST_HEAD(&dma->channels);
1006} 1006}
diff --git a/drivers/dma/imx-dma.c b/drivers/dma/imx-dma.c
index 139c5676cd74..48d85f8b95fe 100644
--- a/drivers/dma/imx-dma.c
+++ b/drivers/dma/imx-dma.c
@@ -1187,7 +1187,7 @@ static int __init imxdma_probe(struct platform_device *pdev)
1187 1187
1188 platform_set_drvdata(pdev, imxdma); 1188 platform_set_drvdata(pdev, imxdma);
1189 1189
1190 imxdma->dma_device.copy_align = 2; /* 2^2 = 4 bytes alignment */ 1190 imxdma->dma_device.copy_align = DMAENGINE_ALIGN_4_BYTES;
1191 imxdma->dma_device.dev->dma_parms = &imxdma->dma_parms; 1191 imxdma->dma_device.dev->dma_parms = &imxdma->dma_parms;
1192 dma_set_max_seg_size(imxdma->dma_device.dev, 0xffffff); 1192 dma_set_max_seg_size(imxdma->dma_device.dev, 0xffffff);
1193 1193
diff --git a/drivers/dma/k3dma.c b/drivers/dma/k3dma.c
index 647e362f01fd..1ba2fd73852d 100644
--- a/drivers/dma/k3dma.c
+++ b/drivers/dma/k3dma.c
@@ -24,7 +24,6 @@
24#include "virt-dma.h" 24#include "virt-dma.h"
25 25
26#define DRIVER_NAME "k3-dma" 26#define DRIVER_NAME "k3-dma"
27#define DMA_ALIGN 3
28#define DMA_MAX_SIZE 0x1ffc 27#define DMA_MAX_SIZE 0x1ffc
29 28
30#define INT_STAT 0x00 29#define INT_STAT 0x00
@@ -732,7 +731,7 @@ static int k3_dma_probe(struct platform_device *op)
732 d->slave.device_pause = k3_dma_transfer_pause; 731 d->slave.device_pause = k3_dma_transfer_pause;
733 d->slave.device_resume = k3_dma_transfer_resume; 732 d->slave.device_resume = k3_dma_transfer_resume;
734 d->slave.device_terminate_all = k3_dma_terminate_all; 733 d->slave.device_terminate_all = k3_dma_terminate_all;
735 d->slave.copy_align = DMA_ALIGN; 734 d->slave.copy_align = DMAENGINE_ALIGN_8_BYTES;
736 735
737 /* init virtual channel */ 736 /* init virtual channel */
738 d->chans = devm_kzalloc(&op->dev, 737 d->chans = devm_kzalloc(&op->dev,
diff --git a/drivers/dma/mic_x100_dma.h b/drivers/dma/mic_x100_dma.h
index f663b0bdd11d..d89982034e68 100644
--- a/drivers/dma/mic_x100_dma.h
+++ b/drivers/dma/mic_x100_dma.h
@@ -39,7 +39,7 @@
39 */ 39 */
40#define MIC_DMA_MAX_NUM_CHAN 8 40#define MIC_DMA_MAX_NUM_CHAN 8
41#define MIC_DMA_NUM_CHAN 4 41#define MIC_DMA_NUM_CHAN 4
42#define MIC_DMA_ALIGN_SHIFT 6 42#define MIC_DMA_ALIGN_SHIFT DMAENGINE_ALIGN_64_BYTES
43#define MIC_DMA_ALIGN_BYTES (1 << MIC_DMA_ALIGN_SHIFT) 43#define MIC_DMA_ALIGN_BYTES (1 << MIC_DMA_ALIGN_SHIFT)
44#define MIC_DMA_DESC_RX_SIZE (128 * 1024 - 4) 44#define MIC_DMA_DESC_RX_SIZE (128 * 1024 - 4)
45 45
diff --git a/drivers/dma/mmp_pdma.c b/drivers/dma/mmp_pdma.c
index 462a0229a743..e39457f13d4d 100644
--- a/drivers/dma/mmp_pdma.c
+++ b/drivers/dma/mmp_pdma.c
@@ -72,7 +72,6 @@
72#define DCMD_WIDTH4 (3 << 14) /* 4 byte width (Word) */ 72#define DCMD_WIDTH4 (3 << 14) /* 4 byte width (Word) */
73#define DCMD_LENGTH 0x01fff /* length mask (max = 8K - 1) */ 73#define DCMD_LENGTH 0x01fff /* length mask (max = 8K - 1) */
74 74
75#define PDMA_ALIGNMENT 3
76#define PDMA_MAX_DESC_BYTES DCMD_LENGTH 75#define PDMA_MAX_DESC_BYTES DCMD_LENGTH
77 76
78struct mmp_pdma_desc_hw { 77struct mmp_pdma_desc_hw {
@@ -1071,7 +1070,7 @@ static int mmp_pdma_probe(struct platform_device *op)
1071 pdev->device.device_issue_pending = mmp_pdma_issue_pending; 1070 pdev->device.device_issue_pending = mmp_pdma_issue_pending;
1072 pdev->device.device_config = mmp_pdma_config; 1071 pdev->device.device_config = mmp_pdma_config;
1073 pdev->device.device_terminate_all = mmp_pdma_terminate_all; 1072 pdev->device.device_terminate_all = mmp_pdma_terminate_all;
1074 pdev->device.copy_align = PDMA_ALIGNMENT; 1073 pdev->device.copy_align = DMAENGINE_ALIGN_8_BYTES;
1075 pdev->device.src_addr_widths = widths; 1074 pdev->device.src_addr_widths = widths;
1076 pdev->device.dst_addr_widths = widths; 1075 pdev->device.dst_addr_widths = widths;
1077 pdev->device.directions = BIT(DMA_MEM_TO_DEV) | BIT(DMA_DEV_TO_MEM); 1076 pdev->device.directions = BIT(DMA_MEM_TO_DEV) | BIT(DMA_DEV_TO_MEM);
diff --git a/drivers/dma/mmp_tdma.c b/drivers/dma/mmp_tdma.c
index e683761e0f8f..3df0422607d5 100644
--- a/drivers/dma/mmp_tdma.c
+++ b/drivers/dma/mmp_tdma.c
@@ -100,7 +100,6 @@ enum mmp_tdma_type {
100 PXA910_SQU, 100 PXA910_SQU,
101}; 101};
102 102
103#define TDMA_ALIGNMENT 3
104#define TDMA_MAX_XFER_BYTES SZ_64K 103#define TDMA_MAX_XFER_BYTES SZ_64K
105 104
106struct mmp_tdma_chan { 105struct mmp_tdma_chan {
@@ -695,7 +694,7 @@ static int mmp_tdma_probe(struct platform_device *pdev)
695 tdev->device.device_pause = mmp_tdma_pause_chan; 694 tdev->device.device_pause = mmp_tdma_pause_chan;
696 tdev->device.device_resume = mmp_tdma_resume_chan; 695 tdev->device.device_resume = mmp_tdma_resume_chan;
697 tdev->device.device_terminate_all = mmp_tdma_terminate_all; 696 tdev->device.device_terminate_all = mmp_tdma_terminate_all;
698 tdev->device.copy_align = TDMA_ALIGNMENT; 697 tdev->device.copy_align = DMAENGINE_ALIGN_8_BYTES;
699 698
700 dma_set_mask(&pdev->dev, DMA_BIT_MASK(64)); 699 dma_set_mask(&pdev->dev, DMA_BIT_MASK(64));
701 platform_set_drvdata(pdev, tdev); 700 platform_set_drvdata(pdev, tdev);
diff --git a/drivers/dma/ste_dma40.c b/drivers/dma/ste_dma40.c
index 3c10f034d4b9..750d1b313684 100644
--- a/drivers/dma/ste_dma40.c
+++ b/drivers/dma/ste_dma40.c
@@ -2853,7 +2853,7 @@ static void d40_ops_init(struct d40_base *base, struct dma_device *dev)
2853 * This controller can only access address at even 2853 * This controller can only access address at even
2854 * 32bit boundaries, i.e. 2^2 2854 * 32bit boundaries, i.e. 2^2
2855 */ 2855 */
2856 dev->copy_align = 2; 2856 dev->copy_align = DMAENGINE_ALIGN_4_BYTES;
2857 } 2857 }
2858 2858
2859 if (dma_has_cap(DMA_SG, dev->cap_mask)) 2859 if (dma_has_cap(DMA_SG, dev->cap_mask))
diff --git a/drivers/dma/sun6i-dma.c b/drivers/dma/sun6i-dma.c
index 842ff97c2cfb..73e0be6e2100 100644
--- a/drivers/dma/sun6i-dma.c
+++ b/drivers/dma/sun6i-dma.c
@@ -969,7 +969,7 @@ static int sun6i_dma_probe(struct platform_device *pdev)
969 sdc->slave.device_issue_pending = sun6i_dma_issue_pending; 969 sdc->slave.device_issue_pending = sun6i_dma_issue_pending;
970 sdc->slave.device_prep_slave_sg = sun6i_dma_prep_slave_sg; 970 sdc->slave.device_prep_slave_sg = sun6i_dma_prep_slave_sg;
971 sdc->slave.device_prep_dma_memcpy = sun6i_dma_prep_dma_memcpy; 971 sdc->slave.device_prep_dma_memcpy = sun6i_dma_prep_dma_memcpy;
972 sdc->slave.copy_align = 4; 972 sdc->slave.copy_align = DMAENGINE_ALIGN_4_BYTES;
973 sdc->slave.device_config = sun6i_dma_config; 973 sdc->slave.device_config = sun6i_dma_config;
974 sdc->slave.device_pause = sun6i_dma_pause; 974 sdc->slave.device_pause = sun6i_dma_pause;
975 sdc->slave.device_resume = sun6i_dma_resume; 975 sdc->slave.device_resume = sun6i_dma_resume;
diff --git a/drivers/dma/xgene-dma.c b/drivers/dma/xgene-dma.c
index 620fd55ec766..fe87a634b145 100644
--- a/drivers/dma/xgene-dma.c
+++ b/drivers/dma/xgene-dma.c
@@ -150,7 +150,6 @@
150#define XGENE_DMA_PQ_CHANNEL 1 150#define XGENE_DMA_PQ_CHANNEL 1
151#define XGENE_DMA_MAX_BYTE_CNT 0x4000 /* 16 KB */ 151#define XGENE_DMA_MAX_BYTE_CNT 0x4000 /* 16 KB */
152#define XGENE_DMA_MAX_64B_DESC_BYTE_CNT 0x14000 /* 80 KB */ 152#define XGENE_DMA_MAX_64B_DESC_BYTE_CNT 0x14000 /* 80 KB */
153#define XGENE_DMA_XOR_ALIGNMENT 6 /* 64 Bytes */
154#define XGENE_DMA_MAX_XOR_SRC 5 153#define XGENE_DMA_MAX_XOR_SRC 5
155#define XGENE_DMA_16K_BUFFER_LEN_CODE 0x0 154#define XGENE_DMA_16K_BUFFER_LEN_CODE 0x0
156#define XGENE_DMA_INVALID_LEN_CODE 0x7800000000000000ULL 155#define XGENE_DMA_INVALID_LEN_CODE 0x7800000000000000ULL
@@ -1740,13 +1739,13 @@ static void xgene_dma_set_caps(struct xgene_dma_chan *chan,
1740 if (dma_has_cap(DMA_XOR, dma_dev->cap_mask)) { 1739 if (dma_has_cap(DMA_XOR, dma_dev->cap_mask)) {
1741 dma_dev->device_prep_dma_xor = xgene_dma_prep_xor; 1740 dma_dev->device_prep_dma_xor = xgene_dma_prep_xor;
1742 dma_dev->max_xor = XGENE_DMA_MAX_XOR_SRC; 1741 dma_dev->max_xor = XGENE_DMA_MAX_XOR_SRC;
1743 dma_dev->xor_align = XGENE_DMA_XOR_ALIGNMENT; 1742 dma_dev->xor_align = DMAENGINE_ALIGN_64_BYTES;
1744 } 1743 }
1745 1744
1746 if (dma_has_cap(DMA_PQ, dma_dev->cap_mask)) { 1745 if (dma_has_cap(DMA_PQ, dma_dev->cap_mask)) {
1747 dma_dev->device_prep_dma_pq = xgene_dma_prep_pq; 1746 dma_dev->device_prep_dma_pq = xgene_dma_prep_pq;
1748 dma_dev->max_pq = XGENE_DMA_MAX_XOR_SRC; 1747 dma_dev->max_pq = XGENE_DMA_MAX_XOR_SRC;
1749 dma_dev->pq_align = XGENE_DMA_XOR_ALIGNMENT; 1748 dma_dev->pq_align = DMAENGINE_ALIGN_64_BYTES;
1750 } 1749 }
1751} 1750}
1752 1751
diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h
index e2f5eb419976..03ed832adbc2 100644
--- a/include/linux/dmaengine.h
+++ b/include/linux/dmaengine.h
@@ -585,6 +585,20 @@ struct dma_tx_state {
585}; 585};
586 586
587/** 587/**
588 * enum dmaengine_alignment - defines alignment of the DMA async tx
589 * buffers
590 */
591enum dmaengine_alignment {
592 DMAENGINE_ALIGN_1_BYTE = 0,
593 DMAENGINE_ALIGN_2_BYTES = 1,
594 DMAENGINE_ALIGN_4_BYTES = 2,
595 DMAENGINE_ALIGN_8_BYTES = 3,
596 DMAENGINE_ALIGN_16_BYTES = 4,
597 DMAENGINE_ALIGN_32_BYTES = 5,
598 DMAENGINE_ALIGN_64_BYTES = 6,
599};
600
601/**
588 * struct dma_device - info on the entity supplying DMA services 602 * struct dma_device - info on the entity supplying DMA services
589 * @chancnt: how many DMA channels are supported 603 * @chancnt: how many DMA channels are supported
590 * @privatecnt: how many DMA channels are requested by dma_request_channel 604 * @privatecnt: how many DMA channels are requested by dma_request_channel
@@ -645,10 +659,10 @@ struct dma_device {
645 dma_cap_mask_t cap_mask; 659 dma_cap_mask_t cap_mask;
646 unsigned short max_xor; 660 unsigned short max_xor;
647 unsigned short max_pq; 661 unsigned short max_pq;
648 u8 copy_align; 662 enum dmaengine_alignment copy_align;
649 u8 xor_align; 663 enum dmaengine_alignment xor_align;
650 u8 pq_align; 664 enum dmaengine_alignment pq_align;
651 u8 fill_align; 665 enum dmaengine_alignment fill_align;
652 #define DMA_HAS_PQ_CONTINUE (1 << 15) 666 #define DMA_HAS_PQ_CONTINUE (1 << 15)
653 667
654 int dev_id; 668 int dev_id;
@@ -833,7 +847,8 @@ static inline dma_cookie_t dmaengine_submit(struct dma_async_tx_descriptor *desc
833 return desc->tx_submit(desc); 847 return desc->tx_submit(desc);
834} 848}
835 849
836static inline bool dmaengine_check_align(u8 align, size_t off1, size_t off2, size_t len) 850static inline bool dmaengine_check_align(enum dmaengine_alignment align,
851 size_t off1, size_t off2, size_t len)
837{ 852{
838 size_t mask; 853 size_t mask;
839 854