kernel_optimize_test/drivers/dma
Cyrille Pitchen 93dce3a643 dmaengine: at_hdmac: fix residue computation
As claimed by the programmer datasheet and confirmed by the IP designer,
the Block Transfer Size (BTSIZE) bitfield of the Channel x Control A
Register (CTRLAx) always refers to a number of Source Width (SRC_WIDTH)
transfers.

Both the SRC_WIDTH and BTSIZE bitfields can be extacted from the CTRLAx
register to compute the DMA residue. So the 'tx_width' field is useless
and can be removed from the struct at_desc.

Before this patch, atc_prep_slave_sg() was not consistent: BTSIZE was
correctly initialized according to the SRC_WIDTH but 'tx_width' was always
set to reg_width, which was incorrect for MEM_TO_DEV transfers. It led to
bad DMA residue when 'tx_width' != SRC_WIDTH.

Also the 'tx_width' field was mostly set only in the first and last
descriptors. Depending on the kind of DMA transfer, this field remained
uninitialized for intermediate descriptors. The accurate DMA residue was
computed only when the currently processed descriptor was the first or the
last of the chain. This algorithm was a little bit odd. An accurate DMA
residue can always be computed using the SRC_WIDTH and BTSIZE bitfields
in the CTRLAx register.

Finally, the test to check whether the currently processed descriptor is
the last of the chain was wrong: for cyclic transfer, last_desc->lli.dscr
is NOT equal to zero, since set_desc_eol() is never called, but logically
equal to first_desc->txd.phys. This bug has a side effect on the
drivers/tty/serial/atmel_serial.c driver, which uses cyclic DMA transfer
to receive data. Since the DMA residue was wrong each time the DMA
transfer reaches the second (and last) period of the transfer, no more
data were received by the USART driver till the cyclic DMA transfer loops
back to the first period.

Signed-off-by: Cyrille Pitchen <cyrille.pitchen@atmel.com>
Acked-by: Torsten Fleischer <torfl6749@gmail.com>
Tested-by: Jirí Prchal <jiri.prchal@aksignal.cz>
Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
2015-07-31 20:33:42 +05:30
..
bestcomm
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
sh dmaengine updates for 4.2-rc1 2015-06-29 09:44:45 -07:00
xilinx
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 bug about channel configuration 2015-07-31 20:33:41 +05:30
bcm2835-dma.c
coh901318_lli.c
coh901318.c
coh901318.h
cppi41.c
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.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
fsl_raid.h
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
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
k3dma.c
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
mpc512x_dma.c
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