diff options
Diffstat (limited to 'drivers/dma/edma.c')
-rw-r--r-- | drivers/dma/edma.c | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/drivers/dma/edma.c b/drivers/dma/edma.c index 3879f80a4815..a7ea20e7b8e9 100644 --- a/drivers/dma/edma.c +++ b/drivers/dma/edma.c | |||
@@ -1143,11 +1143,24 @@ static struct dma_async_tx_descriptor *edma_prep_dma_memcpy( | |||
1143 | struct edma_desc *edesc; | 1143 | struct edma_desc *edesc; |
1144 | struct device *dev = chan->device->dev; | 1144 | struct device *dev = chan->device->dev; |
1145 | struct edma_chan *echan = to_edma_chan(chan); | 1145 | struct edma_chan *echan = to_edma_chan(chan); |
1146 | unsigned int width, pset_len; | 1146 | unsigned int width, pset_len, array_size; |
1147 | 1147 | ||
1148 | if (unlikely(!echan || !len)) | 1148 | if (unlikely(!echan || !len)) |
1149 | return NULL; | 1149 | return NULL; |
1150 | 1150 | ||
1151 | /* Align the array size (acnt block) with the transfer properties */ | ||
1152 | switch (__ffs((src | dest | len))) { | ||
1153 | case 0: | ||
1154 | array_size = SZ_32K - 1; | ||
1155 | break; | ||
1156 | case 1: | ||
1157 | array_size = SZ_32K - 2; | ||
1158 | break; | ||
1159 | default: | ||
1160 | array_size = SZ_32K - 4; | ||
1161 | break; | ||
1162 | } | ||
1163 | |||
1151 | if (len < SZ_64K) { | 1164 | if (len < SZ_64K) { |
1152 | /* | 1165 | /* |
1153 | * Transfer size less than 64K can be handled with one paRAM | 1166 | * Transfer size less than 64K can be handled with one paRAM |
@@ -1169,7 +1182,7 @@ static struct dma_async_tx_descriptor *edma_prep_dma_memcpy( | |||
1169 | * When the full_length is multibple of 32767 one slot can be | 1182 | * When the full_length is multibple of 32767 one slot can be |
1170 | * used to complete the transfer. | 1183 | * used to complete the transfer. |
1171 | */ | 1184 | */ |
1172 | width = SZ_32K - 1; | 1185 | width = array_size; |
1173 | pset_len = rounddown(len, width); | 1186 | pset_len = rounddown(len, width); |
1174 | /* One slot is enough for lengths multiple of (SZ_32K -1) */ | 1187 | /* One slot is enough for lengths multiple of (SZ_32K -1) */ |
1175 | if (unlikely(pset_len == len)) | 1188 | if (unlikely(pset_len == len)) |
@@ -1217,7 +1230,7 @@ static struct dma_async_tx_descriptor *edma_prep_dma_memcpy( | |||
1217 | } | 1230 | } |
1218 | dest += pset_len; | 1231 | dest += pset_len; |
1219 | src += pset_len; | 1232 | src += pset_len; |
1220 | pset_len = width = len % (SZ_32K - 1); | 1233 | pset_len = width = len % array_size; |
1221 | 1234 | ||
1222 | ret = edma_config_pset(chan, &edesc->pset[1], src, dest, 1, | 1235 | ret = edma_config_pset(chan, &edesc->pset[1], src, dest, 1, |
1223 | width, pset_len, DMA_MEM_TO_MEM); | 1236 | width, pset_len, DMA_MEM_TO_MEM); |