linux-kernel-test/drivers/dma
Cyrille Pitchen 1c8a38b126 dmaengine: at_xdmac: fix transfer data width in at_xdmac_prep_slave_sg()
This patch adds the missing update of the transfer data width in
at_xdmac_prep_slave_sg().

Indeed, for each item in the scatter-gather list, we check whether the
transfer length is aligned with the data width provided by
dmaengine_slave_config(). If so, we directly use this data width for the
current part of the transfer we are preparing. Otherwise, the data width
is reduced to 8 bits (1 byte). Of course, the actual number of register
accesses must also be updated to match the new data width.

So one chunk was missing in the original patch (see Fixes tag below): the
number of register accesses was correctly set to (len >> fixed_dwidth) in
mbr_ubc but the real data width was not updated in mbr_cfg. Since mbr_cfg
may change for each part of the scatter-gather transfer this also explains
why the original patch used the Descriptor View 2 instead of the
Descriptor View 1.

Let's take the example of a DMA transfer to write 8bit data into an Atmel
USART with FIFOs. When FIFOs are enabled in the USART, its Transmit
Holding Register (THR) works in multidata mode, that is to say that up to
4 8bit data can be written into the THR in a single 32bit access and it is
still possible to write only one data with a 8bit access. To take
advantage of this new feature, the DMA driver was modified to allow
multiple dwidths when doing slave transfers.
For instance, when the total length is 22 bytes, the USART driver splits
the transfer into 2 parts:

First part: 20 bytes transferred through 5 32bit writes into THR
Second part: 2 bytes transferred though 2 8bit writes into THR

For the second part, the data width was first set to 4_BYTES by the USART
driver thanks to dmaengine_slave_config() then at_xdmac_prep_slave_sg()
reduces this data width to 1_BYTE because the 2 byte length is not aligned
with the original 4_BYTES data width. Since the data width is modified,
the actual number of writes into THR must be set accordingly.

Signed-off-by: Cyrille Pitchen <cyrille.pitchen@atmel.com>
Fixes: 6d3a7d9e3a ("dmaengine: at_xdmac: allow muliple dwidths when doing slave transfers")
Cc: stable@vger.kernel.org #4.0 and later
Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Acked-by: Ludovic Desroches <ludovic.desroches@atmel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
2015-07-31 20:33:42 +05:30
..
bestcomm dmaengine: constify of_device_id array 2015-03-18 22:13:14 +05:30
dw Merge branch 'for-linus' of git://git.infradead.org/users/vkoul/slave-dma 2015-04-24 09:49:37 -07:00
hsu dmaengine: hsu: Fix memory leak when stopping a running transfer 2015-06-02 18:33:08 +05:30
ioat Merge branch 'for-linus' of git://git.infradead.org/users/vkoul/slave-dma 2015-04-24 09:49:37 -07:00
ipu
ppc4xx dmaengine: Remove FSF mailing addresses 2015-03-16 22:28:15 +05:30
sh dmaengine updates for 4.2-rc1 2015-06-29 09:44:45 -07:00
xilinx dmaengine: xilinx-dma: move header file to common location 2015-03-17 16:23:21 +05:30
acpi-dma.c
amba-pl08x.c dmaengine: pl08x: Suppress spaces in indentation 2015-05-08 14:29:32 +05:30
at_hdmac_regs.h dmaengine: at_hdmac: fix residue computation 2015-07-31 20:33:42 +05:30
at_hdmac.c dmaengine: at_hdmac: fix residue computation 2015-07-31 20:33:42 +05:30
at_xdmac.c dmaengine: at_xdmac: fix transfer data width in at_xdmac_prep_slave_sg() 2015-07-31 20:33:42 +05:30
bcm2835-dma.c dmaengine: bcm2835-dma: Fix memory leak when stopping a running transfer 2015-03-30 23:17:08 +05:30
coh901318_lli.c
coh901318.c
coh901318.h
cppi41.c dmaengine: cppi41: add missing bitfields 2015-04-11 21:12:58 +05:30
dma-jz4740.c Merge branch 'for-linus' of git://git.infradead.org/users/vkoul/slave-dma 2015-04-24 09:49:37 -07:00
dma-jz4780.c dmaengine: jz4780: add driver for the Ingenic JZ4780 DMA controller 2015-04-01 08:43:49 +05:30
dmaengine.c dmaengine updates for 4.2-rc1 2015-06-29 09:44:45 -07:00
dmaengine.h
dmatest.c kernel/params: constify struct kernel_param_ops uses 2015-05-28 11:32:10 +09:30
edma.c dmaenegine: edma: allow pause/resume for non-cyclic mode 2015-05-06 22:27:01 +02:00
ep93xx_dma.c dmaengine: ep93xx: Constify platform_device_id 2015-05-04 16:38:55 +05:30
fsl_raid.c dmaengine: fsl_raid: statify fsl_re_chan_probe 2015-04-02 16:11:35 +05:30
fsl_raid.h dmaengine: Driver support for FSL RaidEngine device. 2015-04-02 16:10:27 +05:30
fsl-edma.c dmaengine: fsl-edma: clear pending interrupts on initialization 2015-06-25 09:22:32 +05:30
fsldma.c
fsldma.h
img-mdc-dma.c dmaengine: img-mdc: remove device_alloc_chan_resources handler 2015-03-18 22:44:58 +05:30
imx-dma.c dmaengine: imx: Constify platform_device_id 2015-05-04 16:38:55 +05:30
imx-sdma.c dmaengine: imx: Constify platform_device_id 2015-05-04 16:38:55 +05:30
iop-adma.c dmaengine: Remove FSF mailing addresses 2015-03-16 22:28:15 +05:30
k3dma.c Merge branch 'topic/alloc_removal' into for-linus 2015-03-18 22:46:19 +05:30
Kconfig Merge branch 'topic/pxa' into for-linus 2015-06-25 09:21:58 +05:30
Makefile Merge branch 'topic/pxa' into for-linus 2015-06-25 09:21:58 +05:30
mic_x100_dma.c x86/mm: Decouple <linux/vmalloc.h> from <asm/io.h> 2015-06-03 12:02:00 +02:00
mic_x100_dma.h
mmp_pdma.c Merge branch 'for-linus' of git://git.infradead.org/users/vkoul/slave-dma 2015-04-24 09:49:37 -07:00
mmp_tdma.c genalloc: rename of_get_named_gen_pool() to of_gen_pool_get() 2015-06-30 19:45:01 -07:00
moxart-dma.c dmaengine: moxart-dma: Fix memory leak when stopping a running transfer 2015-03-30 23:17:08 +05:30
mpc512x_dma.c dmaengine: constify of_device_id array 2015-03-18 22:13:14 +05:30
mv_xor.c dmaengine: mv_xor: improve descriptors list handling and reduce locking 2015-06-10 22:18:31 +05:30
mv_xor.h dmaengine: mv_xor: improve descriptors list handling and reduce locking 2015-06-10 22:18:31 +05:30
mxs-dma.c dmaengine: mxs: Constify platform_device_id 2015-05-04 16:38:55 +05:30
nbpfaxi.c dmaengine: nbpfaxi: Constify platform_device_id 2015-05-04 16:38:55 +05:30
of-dma.c dmaengine: of_dma: Support for DMA routers 2015-05-09 17:11:25 +05:30
omap-dma.c Merge branch 'topic/omap' into for-linus 2015-06-25 09:21:43 +05:30
pch_dma.c dmaengine: pch_dma: fix memory leak on failure path in pch_dma_probe() 2015-04-17 23:41:46 +05:30
pl330.c dmaengine: pl330: Really fix choppy sound because of wrong residue calculation 2015-07-07 09:30:16 +05:30
pxa_dma.c dmaengine: pxa_dma: add support for legacy transition 2015-05-29 14:42:48 +05:30
qcom_bam_dma.c Merge branch 'for-linus' of git://git.infradead.org/users/vkoul/slave-dma 2015-04-24 09:49:37 -07:00
s3c24xx-dma.c dmaengine: s3c24xx: Constify platform_device_id 2015-05-04 16:38:55 +05:30
sa11x0-dma.c dmaengine: sa11x0: report slave capabilities to upper layers 2015-04-17 23:24:35 +05:30
sirf-dma.c dmaengine: sirf: add CSRatlas7 SoC support 2015-06-08 10:26:58 +05:30
ste_dma40_ll.c
ste_dma40_ll.h
ste_dma40.c Merge branch 'for-linus' of git://git.infradead.org/users/vkoul/slave-dma 2015-04-24 09:49:37 -07:00
sun6i-dma.c dmaengine: sun6i: Add support for Allwinner H3 (sun8i) variant 2015-05-08 14:55:31 +05:30
tegra20-apb-dma.c
ti-dma-crossbar.c dmaengine: Add driver for TI DMA crossbar on DRA7x 2015-05-14 20:49:25 +05:30
timb_dma.c
TODO
txx9dmac.c
txx9dmac.h
virt-dma.c dmaengine: virt-dma: don't always free descriptor upon completion 2015-06-17 22:15:59 +05:30
virt-dma.h dmaengine: virt-dma: don't always free descriptor upon completion 2015-06-17 22:15:59 +05:30
xgene-dma.c dmaengine: xgene: fix file permission 2015-06-25 09:22:32 +05:30