linux-stable/drivers/spi
Marc Kleine-Budde 87e0621a6b spi: spi-imx: imx51: revert burst length calculation back to bits_per_word
[ Upstream commit df75470b31 ]

The patch 15a6af94a2 ("spi: Increase imx51 ecspi burst length based
on transfer length") increased the burst length calculation in
mx51_ecspi_prepare_transfer() to be based on the transfer length.

This breaks HW CS + SPI_CS_WORD support which was added in
6e95b23a5b ("spi: imx: Implement support for CS_WORD") and transfers
with bits-per-word != 8, 16, 32.

SPI_CS_WORD means the CS should be toggled after each word. The
implementation in the imx-spi driver relies on the fact that the HW CS
is toggled automatically by the controller after each burst length
number of bits. Setting the burst length to the number of bits of the
_whole_ message breaks this use case.

Further the patch 15a6af94a2 ("spi: Increase imx51 ecspi burst
length based on transfer length") claims to optimize the transfers.
But even without this patch, on modern spi-imx controllers with
"dynamic_burst = true" (imx51, imx6 and newer), the transfers are
already optimized, i.e. the burst length is dynamically adjusted in
spi_imx_push() to avoid the pause between the SPI bursts. This has
been confirmed by a scope measurement on an imx6d.

Subsequent Patches tried to fix these and other problems:

- 5f66db08cb ("spi: imx: Take in account bits per word instead of assuming 8-bits")
- e9b220aeac ("spi: spi-imx: correctly configure burst length when using dma")
- c712c05e46 ("spi: imx: fix the burst length at DMA mode and CPU mode")
- cf6d79a0f5 ("spi: spi-imx: fix off-by-one in mx51 CPU mode burst length")

but the HW CS + SPI_CS_WORD use case is still broken.

To fix the problems revert the burst size calculation in
mx51_ecspi_prepare_transfer() back to the original form, before
15a6af94a2 ("spi: Increase imx51 ecspi burst length based on
transfer length") was applied.

Cc: Stefan Moring <stefan.moring@technolution.nl>
Cc: Stefan Bigler <linux@bigler.io>
Cc: Clark Wang <xiaoning.wang@nxp.com>
Cc: Carlos Song <carlos.song@nxp.com>
Cc: Sebastian Reichel <sre@kernel.org>
Cc: Thorsten Scherer <T.Scherer@eckelmann.de>
Fixes: 15a6af94a2 ("spi: Increase imx51 ecspi burst length based on transfer length")
Fixes: 5f66db08cb ("spi: imx: Take in account bits per word instead of assuming 8-bits")
Fixes: e9b220aeac ("spi: spi-imx: correctly configure burst length when using dma")
Fixes: c712c05e46 ("spi: imx: fix the burst length at DMA mode and CPU mode")
Fixes: cf6d79a0f5 ("spi: spi-imx: fix off-by-one in mx51 CPU mode burst length")
Link: https://lore.kernel.org/all/20240618-oxpecker-of-ideal-mastery-db59f8-mkl@pengutronix.de
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Tested-by: Thorsten Scherer <t.scherer@eckelmann.de>
Link: https://msgid.link/r/20240618-spi-imx-fix-bustlength-v1-1-2053dd5fdf87@pengutronix.de
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-06-27 13:49:10 +02:00
..
atmel-quadspi.c spi: atmel-quadspi: Convert to platform remove callback returning void 2023-03-17 15:47:51 +00:00
internals.h
Kconfig spi: spi-zynqmp-gqspi: fix driver kconfig dependencies 2024-01-25 15:35:14 -08:00
Makefile Add cs42l43 PC focused SoundWire CODEC 2023-08-18 22:46:19 +01:00
spi-altera-core.c spi: Replace all spi->chip_select and spi->cs_gpiod references with function call 2023-03-11 12:34:01 +00:00
spi-altera-dfl.c
spi-altera-platform.c
spi-amd.c spi: amd: fix Wvoid-pointer-to-enum-cast warning 2023-08-14 13:11:15 +01:00
spi-amlogic-spifc-a1.c spi: amlogic-spifc-a1: switch to use devm_spi_alloc_host() 2023-08-14 13:10:48 +01:00
spi-ar934x.c spi: Explicitly include correct DT includes 2023-07-14 20:53:00 +01:00
spi-armada-3700.c spi: Explicitly include correct DT includes 2023-07-14 20:53:00 +01:00
spi-aspeed-smc.c spi: aspeed: switch to use modern name 2023-08-07 14:38:18 +01:00
spi-at91-usart.c spi: at91-usart: Use PTR_ERR_OR_ZERO() to simplify code 2023-08-22 13:51:35 +01:00
spi-ath79.c spi: Rename SPI_MASTER_GPIO_SS to SPI_CONTROLLER_GPIO_SS 2023-07-11 14:12:56 +01:00
spi-atmel.c spi: atmel: Fix clock issue when using devices with different polarities 2024-01-01 12:42:44 +00:00
spi-au1550.c spi: au1550: switch to use modern name 2023-08-14 13:10:49 +01:00
spi-axi-spi-engine.c spi: axi-spi-engine: fix version format string 2024-05-17 12:02:01 +02:00
spi-bcm-qspi.c spi: bcm-qspi: fix SFDP BFPT read by usig mspi read 2024-01-31 16:19:13 -08:00
spi-bcm-qspi.h
spi-bcm63xx-hsspi.c spi: bcm63xx-hsspi: switch to use modern name 2023-08-07 14:38:23 +01:00
spi-bcm63xx.c spi: bcm63xx: switch to use modern name 2023-08-07 14:38:24 +01:00
spi-bcm2835.c spi: switch to use modern name 2023-08-07 21:59:25 +01:00
spi-bcm2835aux.c spi: switch to use modern name 2023-08-07 21:59:25 +01:00
spi-bcmbca-hsspi.c spi: bcmbca-hsspi: switch to use modern name 2023-08-14 13:10:59 +01:00
spi-bitbang-txrx.h spi: Get rid of old SPI_MASTER_NO_TX & SPI_MASTER_NO_RX 2023-07-11 13:41:20 +01:00
spi-bitbang.c spi: Rename SPI_MASTER_GPIO_SS to SPI_CONTROLLER_GPIO_SS 2023-07-11 14:12:56 +01:00
spi-brcmstb-qspi.c spi: brcmstb-qspi: Convert to platform remove callback returning void 2023-03-06 12:31:15 +00:00
spi-butterfly.c spi: butterfly: switch to use modern name 2023-08-07 14:38:25 +01:00
spi-cadence-quadspi.c spi: cadence-qspi: fix pointer reference in runtime PM hooks 2024-03-06 14:48:34 +00:00
spi-cadence-xspi.c spi: cadence-xspi: switch to use modern name 2023-08-07 14:38:26 +01:00
spi-cadence.c spi: spi-cadence: Reverse the order of interleaved write and read operations 2024-01-31 16:19:13 -08:00
spi-cavium-octeon.c spi: octeon: switch to use modern name 2023-08-07 14:38:29 +01:00
spi-cavium-thunderx.c spi: spi-cavium-thunderx: switch to use modern name 2023-08-07 14:38:30 +01:00
spi-cavium.c spi: Replace all spi->chip_select and spi->cs_gpiod references with function call 2023-03-11 12:34:01 +00:00
spi-cavium.h
spi-clps711x.c spi: clps711x: switch to use modern name 2023-08-07 14:38:28 +01:00
spi-coldfire-qspi.c spi: coldfire-qspi: Remove an erroneous clk_disable_unprepare() from the remove function 2024-01-25 15:35:55 -08:00
spi-cs42l43.c spi: cs42l43: Correct SPI root clock speed 2024-06-27 13:49:08 +02:00
spi-davinci.c spi: davinci: switch to use modern name 2023-08-07 14:38:31 +01:00
spi-dln2.c spi: dln2: switch to use modern name 2023-08-07 14:38:32 +01:00
spi-dw-bt1.c spi: dw-bt1: Convert to platform remove callback returning void 2023-03-06 12:31:21 +00:00
spi-dw-core.c spi: dw: switch to use modern name 2023-08-07 14:38:33 +01:00
spi-dw-dma.c spi: dw: switch to use modern name 2023-08-07 14:38:33 +01:00
spi-dw-mmio.c spi: dw-mmio: keep old name same as documentation 2023-08-16 12:58:07 +01:00
spi-dw-pci.c
spi-dw.h spi: dw: switch to use modern name 2023-08-07 14:38:33 +01:00
spi-ep93xx.c spi: ep93xx: switch to use modern name 2023-08-14 13:10:50 +01:00
spi-falcon.c spi: falcon: switch to use modern name 2023-08-14 13:10:51 +01:00
spi-fsi.c spi: fsi: switch to use spi_alloc_host() 2023-08-14 13:10:52 +01:00
spi-fsl-cpm.c spi: fsl-cpm: Properly define and use IO pointers 2023-08-09 12:52:49 +01:00
spi-fsl-cpm.h
spi-fsl-dspi.c spi: fsl-dspi: switch to use modern name 2023-08-14 13:10:53 +01:00
spi-fsl-espi.c spi: fsl-espi: switch to use modern name 2023-08-14 13:10:54 +01:00
spi-fsl-lib.c spi: Explicitly include correct DT includes 2023-07-14 20:53:00 +01:00
spi-fsl-lib.h spi: fsl: Remove unused extern declarations 2023-07-25 17:40:28 +01:00
spi-fsl-lpspi.c spi: lpspi: Avoid potential use-after-free in probe() 2024-03-26 18:20:07 -04:00
spi-fsl-qspi.c spi: fsl-qspi: switch to use modern name 2023-08-14 13:10:55 +01:00
spi-fsl-spi.c spi: fsl-spi: switch to use modern name 2023-08-14 13:10:56 +01:00
spi-fsl-spi.h
spi-geni-qcom.c spi: spi-geni-qcom: Add SPI Device mode support for GENI based QuPv3 2023-07-31 15:57:04 +01:00
spi-gpio.c spi: gpio: switch to use modern name 2023-08-14 13:10:57 +01:00
spi-gxp.c spi: spi-gxp: BUG: Correct spi write return value 2023-09-27 17:06:36 +02:00
spi-hisi-kunpeng.c spi: hisi-kunpeng: Delete the dump interface of data registers in debugfs 2024-05-17 12:02:01 +02:00
spi-hisi-sfc-v3xx.c spi: hisi-sfc-v3xx: Return IRQ_NONE if no interrupts were detected 2024-03-01 13:34:49 +01:00
spi-img-spfi.c spi: img-spfi: switch to use modern name 2023-08-14 13:11:01 +01:00
spi-imx.c spi: spi-imx: imx51: revert burst length calculation back to bits_per_word 2024-06-27 13:49:10 +02:00
spi-ingenic.c spi: ingenic: switch to use devm_spi_alloc_host() 2023-08-14 13:11:03 +01:00
spi-intel-pci.c spi: intel-pci: Add support for Lunar Lake-M SPI serial flash 2024-03-26 18:19:10 -04:00
spi-intel-platform.c
spi-intel.c spi: intel: switch to use modern name 2023-08-14 13:11:04 +01:00
spi-intel.h
spi-iproc-qspi.c spi: bcm-qspi: Simplify logic by using devm_platform_ioremap_resource_byname() 2023-08-21 13:10:56 +01:00
spi-jcore.c spi: jcore: switch to use modern name 2023-08-14 13:11:05 +01:00
spi-lantiq-ssc.c spi: lantiq: switch to use modern name 2023-08-14 13:11:06 +01:00
spi-lm70llp.c
spi-loongson-core.c spi: loongson: add bus driver for the loongson spi controller 2023-07-31 15:57:09 +01:00
spi-loongson-pci.c spi: loongson: add bus driver for the loongson spi controller 2023-07-31 15:57:09 +01:00
spi-loongson-plat.c spi: loongson: add bus driver for the loongson spi controller 2023-07-31 15:57:09 +01:00
spi-loongson.h spi: loongson: add bus driver for the loongson spi controller 2023-07-31 15:57:09 +01:00
spi-loopback-test.c spi: Explicitly include correct DT includes 2023-07-14 20:53:00 +01:00
spi-lp8841-rtc.c spi: Explicitly include correct DT includes 2023-07-14 20:53:00 +01:00
spi-mem.c spi: Replace all spi->chip_select and spi->cs_gpiod references with function call 2023-03-11 12:34:01 +00:00
spi-meson-spicc.c spi: Explicitly include correct DT includes 2023-07-14 20:53:00 +01:00
spi-meson-spifc.c spi: meson-spifc: Convert to platform remove callback returning void 2023-03-06 12:31:33 +00:00
spi-microchip-core-qspi.c spi: microchip-core-qspi: fix setting spi bus clock rate 2024-05-17 12:02:36 +02:00
spi-microchip-core.c spi: microchip-core: Clean up redundant dev_err_probe() 2023-07-28 15:06:14 +01:00
spi-mpc52xx-psc.c spi: spi-mpc52xx-psc: Fix an unsigned comparison that can never be negative 2023-08-07 18:37:54 +01:00
spi-mpc52xx.c spi: Replace all spi->chip_select and spi->cs_gpiod references with function call 2023-03-11 12:34:01 +00:00
spi-mpc512x-psc.c spi: mpc5xxx-psc: Fix unsigned expression compared with zero 2023-08-03 17:07:09 +01:00
spi-mt65xx.c spi: spi-mt65xx: Fix NULL pointer access in interrupt handler 2024-03-26 18:20:13 -04:00
spi-mt7621.c spi: Explicitly include correct DT includes 2023-07-14 20:53:00 +01:00
spi-mtk-nor.c spi: Explicitly include correct DT includes 2023-07-14 20:53:00 +01:00
spi-mtk-snfi.c spi: Explicitly include correct DT includes 2023-07-14 20:53:00 +01:00
spi-mux.c spi: Replace all spi->chip_select and spi->cs_gpiod references with function call 2023-03-11 12:34:01 +00:00
spi-mxic.c spi: Replace all spi->chip_select and spi->cs_gpiod references with function call 2023-03-11 12:34:01 +00:00
spi-mxs.c spi: Convert to SPI_CONTROLLER_HALF_DUPLEX 2023-07-11 14:14:31 +01:00
spi-npcm-fiu.c spi: npcm-fiu: Fix UMA reads when dummy.nbytes == 0 2023-10-02 15:03:19 +01:00
spi-npcm-pspi.c spi: npcm-pspi: Convert to platform remove callback returning void 2023-03-06 21:17:50 +00:00
spi-nxp-fspi.c spi: nxp-fspi: use the correct ioremap function 2023-11-20 11:59:05 +01:00
spi-oc-tiny.c spi: oc-tiny: Convert to platform remove callback returning void 2023-03-06 21:17:51 +00:00
spi-omap-uwire.c spi: Convert to SPI_CONTROLLER_HALF_DUPLEX 2023-07-11 14:14:31 +01:00
spi-omap2-mcspi.c spi: omap2-mcspi: Fix hardcoded reference clock 2023-11-20 11:59:08 +01:00
spi-orion.c spi: orion: switch to use modern name 2023-08-21 14:29:18 +01:00
spi-pci1xxxx.c spi: mchp-pci1xxx: Fix a possible null pointer dereference in pci1xxx_spi_probe 2024-04-10 16:36:01 +02:00
spi-pic32-sqi.c spi: pic32-sqi: switch to use modern name 2023-08-21 14:29:20 +01:00
spi-pic32.c spi: pic32: switch to use modern name 2023-08-21 14:29:21 +01:00
spi-pl022.c spi: spl022: switch to use modern name 2023-08-21 14:29:22 +01:00
spi-ppc4xx.c spi: ppc4xx: Drop write-only variable 2024-02-23 09:24:52 +01:00
spi-pxa2xx-dma.c
spi-pxa2xx-pci.c
spi-pxa2xx.c spi: pxa2xx: switch to use modern name 2023-08-21 14:29:24 +01:00
spi-pxa2xx.h
spi-qcom-qspi.c spi: spi-qcom-qspi: switch to use modern name 2023-08-21 14:29:25 +01:00
spi-qup.c spi: qup: switch to use modern name 2023-08-21 14:29:26 +01:00
spi-rb4xx.c spi: rb4xx: switch to use modern name 2023-08-21 14:29:27 +01:00
spi-realtek-rtl.c spi: realtek-rtl: switch to use devm_spi_alloc_host() 2023-08-21 14:29:28 +01:00
spi-rockchip-sfc.c spi: rockchip-sfc: switch to use modern name 2023-08-21 14:29:29 +01:00
spi-rockchip.c spi: rockchip: switch to use modern name 2023-08-21 14:29:30 +01:00
spi-rpc-if.c spi: rpc-if: switch to use devm_spi_alloc_host() 2023-08-16 12:58:08 +01:00
spi-rspi.c spi: rspi: switch to use spi_alloc_host() 2023-08-21 14:29:30 +01:00
spi-rzv2m-csi.c spi: rzv2m-csi: switch to use devm_spi_alloc_host() 2023-08-21 14:29:31 +01:00
spi-s3c64xx.c spi: s3c64xx: Use DMA mode from fifo size 2024-04-10 16:36:00 +02:00
spi-sc18is602.c spi: sc18is602: switch to use modern name 2023-08-21 14:29:33 +01:00
spi-sh-hspi.c spi: sh-hspi: switch to use modern name 2023-08-21 14:29:34 +01:00
spi-sh-msiof.c spi: sh-msiof: avoid integer overflow in constants 2024-03-01 13:34:51 +01:00
spi-sh-sci.c spi: sh-sci: switch to use modern name 2023-08-21 14:29:36 +01:00
spi-sh.c spi: sh: switch to use modern name 2023-08-21 14:29:37 +01:00
spi-sifive.c spi: sifive: switch to use modern name 2023-08-21 14:29:38 +01:00
spi-slave-mt27xx.c spi: Get rid of old SPI_MASTER_MUST_TX & SPI_MASTER_MUST_RX 2023-07-11 13:41:25 +01:00
spi-slave-system-control.c
spi-slave-time.c
spi-sn-f-ospi.c spi: spi-sn-f-ospi: switch to use modern name 2023-08-21 14:29:39 +01:00
spi-sprd-adi.c spi: Explicitly include correct DT includes 2023-07-14 20:53:00 +01:00
spi-sprd.c spi: Explicitly include correct DT includes 2023-07-14 20:53:00 +01:00
spi-st-ssc4.c spi: Replace all spi->chip_select and spi->cs_gpiod references with function call 2023-03-11 12:34:01 +00:00
spi-stm32-qspi.c spi: Explicitly include correct DT includes 2023-07-14 20:53:00 +01:00
spi-stm32.c spi: stm32: Don't warn about spurious interrupts 2024-06-12 11:12:59 +02:00
spi-sun4i.c spi: Replace all spi->chip_select and spi->cs_gpiod references with function call 2023-03-11 12:34:01 +00:00
spi-sun6i.c spi: Fixes for v6.6 2023-09-07 15:49:20 -07:00
spi-sunplus-sp7021.c spi: sunplus-sp7021: Convert to platform remove callback returning void 2023-03-06 21:18:18 +00:00
spi-synquacer.c spi: Replace all spi->chip_select and spi->cs_gpiod references with function call 2023-03-11 12:34:01 +00:00
spi-tegra20-sflash.c spi: tegra20-sflash: fix to check return value of platform_get_irq() in tegra_sflash_probe() 2023-07-26 16:30:19 +01:00
spi-tegra20-slink.c spi: tegra: Fix missing IRQ check in tegra_slink_probe() 2023-11-20 11:59:04 +01:00
spi-tegra114.c spi: tegra114: Remove unnecessary NULL-pointer checks 2023-08-15 19:55:00 +01:00
spi-tegra210-quad.c spi: Explicitly include correct DT includes 2023-07-14 20:53:00 +01:00
spi-test.h
spi-ti-qspi.c spi: Explicitly include correct DT includes 2023-07-14 20:53:00 +01:00
spi-tle62x0.c
spi-topcliff-pch.c spi: Replace all spi->chip_select and spi->cs_gpiod references with function call 2023-03-11 12:34:01 +00:00
spi-uniphier.c spi: uniphier: Convert to platform remove callback returning void 2023-03-06 21:18:24 +00:00
spi-wpcm-fiu.c spi: Explicitly include correct DT includes 2023-07-14 20:53:00 +01:00
spi-xcomm.c spi: Convert to SPI_CONTROLLER_HALF_DUPLEX 2023-07-11 14:14:31 +01:00
spi-xilinx.c spi: xilinx: Use devm_platform_get_and_ioremap_resource() 2023-03-28 14:49:37 +01:00
spi-xlp.c spi: Replace all spi->chip_select and spi->cs_gpiod references with function call 2023-03-11 12:34:01 +00:00
spi-xtensa-xtfpga.c spi: Get rid of old SPI_MASTER_NO_TX & SPI_MASTER_NO_RX 2023-07-11 13:41:20 +01:00
spi-zynq-qspi.c spi: spi-zynq: Do not check for 0 return after calling platform_get_irq() 2023-08-07 14:38:39 +01:00
spi-zynqmp-gqspi.c spi: Merge up old fix 2023-09-19 13:17:52 +01:00
spi.c spi: Don't mark message DMA mapped when no transfer in it is 2024-06-12 11:12:52 +02:00
spidev.c spi: Updates for v6.5 2023-06-28 13:48:42 -07:00