linux-stable/drivers
Serge Semin bdbdf0f063
spi: dw: Locally wait for the DMA transfers completion
In general each DMA-based SPI transfer can be split up into two stages:
DMA data transmission/reception and SPI-bus transmission/reception. DMA
asynchronous transactions completion can be tracked by means of the
DMA async Tx-descriptor completion callback. But that callback being
called indicates that the DMA transfer has been finished, it doesn't
mean that SPI data transmission is also done. Moreover in fact it isn't
for at least Tx-only SPI transfers. Upon DMA transfer completion some
data is left in the Tx FIFO and being pushed out by the SPI controller.
So in order to make sure that an SPI transfer is completely pushed to the
SPI-bus, the driver has to wait for both DMA transaction and the SPI-bus
transmission/reception are finished. Note if there is a way to
asynchronously track the former event by means of the DMA async Tx
callback, there isn't easy one for the later (IRQ-based solution won't
work since SPI controller doesn't notify about Rx FIFO being empty).

The DMA transfer completion callback isn't suitable to wait for the
SPI controller activity finish either. The callback might (in case of DW
DMAC it will) be called in the tasklet context. Waiting for the SPI
controller to complete the transfer might take a considerable amount of
time since SPI-bus might be pretty slow. In this case delaying the
execution in the tasklet atomic context might cause significant system
performance drop.

So to speak the best option we've got to solve the problem is to
consequently wait for both stages being finished in the locally
implemented SPI transfer execution procedure even if it costs us of the
local wait-function re-implementation. In this case we don't need to use
the SPI-core transfer-wait functionality, but we'll make sure that
all DMA and SPI-bus transactions are completely finished before the
SPI-core transfer_one callback returns. In this commit we provide an
implementation of the DMA-transfers completion wait functionality.
The DW APB SSI DMA-specific SPI transfer_one function waits for both
Tx and Rx DMA transfers being finished, and only then exits with zero
returned signalling to the SPI core that the SPI transfer is finished.
This implementation is fully equivalent to the currently used
DMA-execution-SPI-core-wait algorithm. The SPI-bus transmission/reception
wait methods will be added in the follow-up commits.

Signed-off-by: Serge Semin <Sergey.Semin@baikalelectronics.ru>
Cc: Georgy Vlasov <Georgy.Vlasov@baikalelectronics.ru>
Cc: Ramil Zaripov <Ramil.Zaripov@baikalelectronics.ru>
Cc: Alexey Malahov <Alexey.Malahov@baikalelectronics.ru>
Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Feng Tang <feng.tang@intel.com>
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Rob Herring <robh+dt@kernel.org>
Cc: linux-mips@vger.kernel.org
Cc: devicetree@vger.kernel.org
Link: https://lore.kernel.org/r/20200529131205.31838-4-Sergey.Semin@baikalelectronics.ru
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-05-29 15:55:43 +01:00
..
accessibility
acpi Merge branch 'acpi-pci' 2020-04-24 21:03:57 +02:00
amba Revert "amba: Initialize dma_parms for amba devices" 2020-04-01 08:03:28 +02:00
android
ata ata: sata_inic162x fix a spelling issue 2020-04-23 09:59:30 -06:00
atm
auxdisplay
base Driver core fixes for 5.7-rc3 2020-04-26 11:04:15 -07:00
bcma
block block-5.7-2020-04-24 2020-04-24 12:44:19 -07:00
bluetooth
bus ARM: driver updates 2020-04-03 15:05:35 -07:00
cdrom
char virtio: fixes, cleanups 2020-04-21 12:27:18 -07:00
clk clk: sprd: don't gate uart console clock 2020-04-13 12:20:07 -07:00
clocksource clocksource/drivers/timer-vf-pit: Add missing parenthesis 2020-04-05 09:24:58 +02:00
connector
counter counter: 104-quad-8: Add lock guards - generic interface 2020-04-19 17:50:00 +01:00
cpufreq Additional power management updates for 5.7-rc1 2020-04-06 10:14:39 -07:00
cpuidle Merge branch 'pm-cpuidle' 2020-04-10 11:32:22 +02:00
crypto chcr: Fix CPU hard lockup 2020-04-23 15:51:37 -07:00
dax dax: Move mandatory ->zero_page_range() check in alloc_dax() 2020-04-02 19:15:03 -07:00
dca
devfreq
dio
dma drivers/dma/tegra20-apb-dma.c: fix platform_get_irq.cocci warnings 2020-04-10 15:36:22 -07:00
dma-buf A bunch of fixes to avoid null pointer dereference in fbcon, fix a return 2020-04-08 09:14:34 +10:00
edac Merge branch 'perf-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2020-03-30 16:40:08 -07:00
eisa
extcon Char/Misc driver patches for 5.7-rc1 2020-04-03 13:22:40 -07:00
firewire
firmware Driver core fixes for 5.7-rc3 2020-04-26 11:04:15 -07:00
fpga fpga: dfl: pci: fix return value of cci_pci_sriov_configure 2020-03-30 20:45:30 -07:00
fsi
gnss
gpio This is the bulk of GPIO development for the v5.7 kernel cycle. 2020-04-04 10:27:00 -07:00
gpu drm fixes for 5.7-rc3 2020-04-24 10:20:08 -07:00
greybus
hid Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid 2020-04-01 15:18:42 -07:00
hsi
hv hyperv-fixes for 5.7-rc1 2020-04-14 11:58:04 -07:00
hwmon hwmon: (jc42) Fix name to have no illegal characters 2020-04-18 10:13:07 -07:00
hwspinlock
hwtracing
i2c i2c: tegra: Synchronize DMA before termination 2020-04-15 18:27:31 +02:00
i3c
ide drivers/ide: Fix build regression. 2020-04-04 18:07:59 -07:00
idle Merge branch 'perf-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2020-03-30 16:40:08 -07:00
iio First set of IIO fixes for the 5.7 cycle. 2020-04-20 14:07:00 +02:00
infiniband RDMA 5.7 pull request 2020-04-01 18:18:18 -07:00
input Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input 2020-04-07 20:20:12 -07:00
interconnect interconnect: qcom: Fix uninitialized tcs_cmd::wait 2020-04-23 16:18:07 +02:00
iommu
ipack
irqchip Merge branch 'irq/gic-v4.1-fixes-5.7' into irq/irqchip-5.7 2020-04-17 08:59:55 +01:00
isdn mISDN: make dmril and dmrim static 2020-04-16 13:52:31 -07:00
leds leds: core: Fix warning message when init_data 2020-04-06 23:12:08 +02:00
lightnvm for-5.7/drivers-2020-03-29 2020-03-30 11:43:51 -07:00
macintosh Char/Misc driver patches for 5.7-rc1 2020-04-03 13:22:40 -07:00
mailbox
mcb
md libnvdimm for 5.7 2020-04-08 21:03:40 -07:00
media Power management updates for 5.7-rc1 2020-03-30 15:05:01 -07:00
memory ARM: driver updates 2020-04-03 15:05:35 -07:00
memstick
message
mfd
misc Char/misc driver fixes for 5.7-rc3 2020-04-26 11:17:44 -07:00
mmc MMC core: 2020-03-31 16:13:09 -07:00
most
mtd mtd: spi-nor: Compile files in controllers/ directory 2020-04-09 22:00:13 +02:00
mux
net Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2020-04-24 19:17:30 -07:00
nfc
ntb pci-v5.7-changes 2020-04-03 14:25:02 -07:00
nubus
nvdimm libnvdimm for 5.7 2020-04-08 21:03:40 -07:00
nvme block-5.7-2020-04-10 2020-04-10 10:06:54 -07:00
nvmem
of of: unittest: kmemleak in duplicate property update 2020-04-17 08:31:34 -05:00
opp opp: Manage empty OPP tables with clk handle 2020-04-13 16:14:55 +05:30
oprofile
parisc parisc: Replace setup_irq() by request_irq() 2020-04-05 22:05:23 +02:00
parport
pci PCI: Move Apex Edge TPU class quirk to fix BAR assignment 2020-04-14 19:16:51 -05:00
pcmcia pcmcia: remove some unused space characters 2020-03-31 18:48:22 +02:00
perf arm64 updates for 5.7: 2020-03-31 10:05:01 -07:00
phy phy: tegra: Select USB_COMMON for usb_get_maximum_speed() 2020-04-16 15:05:53 +02:00
pinctrl This is the bulk of GPIO development for the v5.7 kernel cycle. 2020-04-04 10:27:00 -07:00
platform chrome-platform fixes for v5.7-rc2 2020-04-16 15:00:57 -07:00
pnp
power change email address for Pali Rohár 2020-04-10 15:36:22 -07:00
powercap Merge branch 'perf-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2020-03-30 16:40:08 -07:00
pps
ps3 powerpc/ps3: Remove an unneeded NULL check 2020-04-03 00:09:59 +11:00
ptp ptp: Remove unneeded conversion to bool 2020-04-21 15:45:32 -07:00
pwm pwm: pca9685: Fix PWM/GPIO inter-operation 2020-04-03 21:41:42 +02:00
rapidio
ras
regulator spi/regulator: Updates for v5.7 2020-03-30 14:58:26 -07:00
remoteproc remoteproc fixes for v5.7 2020-04-23 09:28:15 -07:00
reset
rpmsg rpmsg: pull in slab.h 2020-04-17 06:05:29 -04:00
rtc - New Drivers 2020-04-07 19:48:52 -07:00
s390 s390/dasd: remove IOSCHED_DEADLINE from DASD Kconfig 2020-04-17 08:05:27 -06:00
sbus
scsi scsi: Update referenced link to cdrtools 2020-04-14 21:16:16 -04:00
sfi
sh
siox
slimbus
soc arm64: soc: ZynqMP SoC fixes for v5.7 2020-04-21 14:21:20 +02:00
soundwire Char/Misc driver patches for 5.7-rc1 2020-04-03 13:22:40 -07:00
spi spi: dw: Locally wait for the DMA transfers completion 2020-05-29 15:55:43 +01:00
spmi
ssb
staging Staging/IIO driver fixes for 5.7-rc3 2020-04-26 11:12:30 -07:00
target scsi: target: tcmu: reset_ring should reset TCMU_DEV_BIT_BROKEN 2020-04-13 14:03:20 -04:00
tc
tee ARM: driver updates 2020-04-03 15:05:35 -07:00
thermal - Convert tsens configuration DT binding to yaml (Rajeshwari) 2020-04-07 20:00:16 -07:00
thunderbolt
tty tty: hvc: fix buffer overflow during hvc_alloc(). 2020-04-23 16:02:07 +02:00
uio
usb USB: sisusbvga: Change port variable from signed to unsigned 2020-04-23 15:26:17 +02:00
vdpa vhost: disable for OABI 2020-04-20 10:19:22 -04:00
vfio vfio: Ignore -ENODEV when getting MSI cookie 2020-04-01 13:51:51 -06:00
vhost vhost: disable for OABI 2020-04-20 10:19:22 -04:00
video drm fixes for 5.7-rc1 2020-04-07 20:24:34 -07:00
virt
virtio virtio-balloon: Avoid using the word 'report' when referring to free page hinting 2020-04-17 06:05:30 -04:00
visorbus
vlynq
vme
w1
watchdog watchdog: sp805: fix restart handler 2020-04-08 11:18:38 +02:00
xen xen: branch for v5.7-rc2 2020-04-17 10:35:17 -07:00
zorro SPDX patches for 5.7-rc1. 2020-04-03 13:12:26 -07:00
Kconfig virtio: fixes, vdpa 2020-04-08 10:51:53 -07:00
Makefile virtio: fixes, vdpa 2020-04-08 10:51:53 -07:00