linux/drivers/spi
Vladimir Oltean c5c31fb71f
spi: fsl-dspi: avoid SCK glitches with continuous transfers
The DSPI controller has configurable timing for

(a) tCSC: the interval between the assertion of the chip select and the
    first clock edge

(b) tASC: the interval between the last clock edge and the deassertion
    of the chip select

What is a bit surprising, but is documented in the figure "Example of
continuous transfer (CPHA=1, CONT=1)" in the datasheet, is that when the
chip select stays asserted between multiple TX FIFO writes, the tCSC and
tASC times still apply. With CONT=1, chip select remains asserted, but
SCK takes a break and goes to the idle state for tASC + tCSC ns.

In other words, the default values (of 0 and 0 ns) result in SCK
glitches where the SCK transition to the idle state, as well as the SCK
transition from the idle state, will have no delay in between, and it
may appear that a SCK cycle has simply gone missing. The resulting
timing violation might cause data corruption in many peripherals, as
their chip select is asserted.

The driver has device tree bindings for tCSC ("fsl,spi-cs-sck-delay")
and tASC ("fsl,spi-sck-cs-delay"), but these are only specified to apply
when the chip select toggles in the first place, and this timing
characteristic depends on each peripheral. Many peripherals do not have
explicit timing requirements, so many device trees do not have these
properties present at all.

Nonetheless, the lack of SCK glitches is a common sense requirement, and
since the SCK stays in the idle state during transfers for tCSC+tASC ns,
and that in itself should look like half a cycle, then let's ensure that
tCSC and tASC are at least a quarter of a SCK period, such that their
sum is at least half of one.

Fixes: 95bf15f386 ("spi: fsl-dspi: Add ~50ns delay between cs and sck")
Reported-by: Lisa Chen (陈敏捷) <minjie.chen@geekplus.com>
Debugged-by: Lisa Chen (陈敏捷) <minjie.chen@geekplus.com>
Tested-by: Lisa Chen (陈敏捷) <minjie.chen@geekplus.com>
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Link: https://lore.kernel.org/r/20230529223402.1199503-1-vladimir.oltean@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2023-06-06 16:49:20 +01: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: add support for Amlogic A1 SPI Flash Controller 2023-04-11 12:40:30 +01:00
Makefile spi: add support for Amlogic A1 SPI Flash Controller 2023-04-11 12:40:30 +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: spi-altera-dfl: switch to use modern name 2022-12-29 13:22:04 +00:00
spi-altera-platform.c spi: spi-altera-platform: switch to use modern name 2022-12-29 13:22:05 +00:00
spi-amd.c spi: Replace all spi->chip_select and spi->cs_gpiod references with function call 2023-03-11 12:34:01 +00:00
spi-amlogic-spifc-a1.c spi: add support for Amlogic A1 SPI Flash Controller 2023-04-11 12:40:30 +01:00
spi-ar934x.c spi: Replace all spi->chip_select and spi->cs_gpiod references with function call 2023-03-11 12:34:01 +00:00
spi-armada-3700.c spi: Replace all spi->chip_select and spi->cs_gpiod references with function call 2023-03-11 12:34:01 +00:00
spi-aspeed-smc.c spi: Replace all spi->chip_select and spi->cs_gpiod references with function call 2023-03-11 12:34:01 +00:00
spi-at91-usart.c spi: Replace all spi->chip_select and spi->cs_gpiod references with function call 2023-03-11 12:34:01 +00:00
spi-ath79.c spi: Replace all spi->chip_select and spi->cs_gpiod references with function call 2023-03-11 12:34:01 +00:00
spi-atmel.c spi: Replace all spi->chip_select and spi->cs_gpiod references with function call 2023-03-11 12:34:01 +00:00
spi-au1550.c spi: Replace all spi->chip_select and spi->cs_gpiod references with function call 2023-03-11 12:34:01 +00:00
spi-axi-spi-engine.c spi: Replace all spi->chip_select and spi->cs_gpiod references with function call 2023-03-11 12:34:01 +00:00
spi-bcm-qspi.c spi: bcm-qspi: Mark OF related data as maybe unused 2023-03-13 14:09:12 +00:00
spi-bcm-qspi.h spi: bcm-qspi: Make bcm_qspi_remove() return void 2022-10-18 19:16:53 +01:00
spi-bcm63xx-hsspi.c spi: Replace all spi->chip_select and spi->cs_gpiod references with function call 2023-03-11 12:34:01 +00:00
spi-bcm63xx.c spi: bcm63xx: use macro DEFINE_SIMPLE_DEV_PM_OPS 2023-04-25 16:55:45 +01:00
spi-bcm2835.c spi: bcm2835: Convert to platform remove callback returning void 2023-03-31 12:54:07 +01:00
spi-bcm2835aux.c spi: Replace all spi->chip_select and spi->cs_gpiod references with function call 2023-03-11 12:34:01 +00:00
spi-bcmbca-hsspi.c spi: Replace all spi->chip_select and spi->cs_gpiod references with function call 2023-03-11 12:34:01 +00:00
spi-bitbang-txrx.h spi: bitbang: Fix lsb-first Rx 2022-08-15 01:26:20 +01:00
spi-bitbang.c
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-cadence-quadspi.c spi: cadence-quadspi: Add missing check for dma_set_mask 2023-06-06 13:52:41 +01:00
spi-cadence-xspi.c spi: Replace all spi->chip_select and spi->cs_gpiod references with function call 2023-03-11 12:34:01 +00:00
spi-cadence.c spi: spi-cadence: Interleave write of TX and read of RX FIFO 2023-05-22 11:41:05 +01:00
spi-cavium-octeon.c spi: cavium-octeon: Convert to platform remove callback returning void 2023-03-06 12:31:17 +00:00
spi-cavium-thunderx.c
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: Use syscon_regmap_lookup_by_phandle 2022-04-25 14:01:09 +01:00
spi-coldfire-qspi.c spi: Replace all spi->chip_select and spi->cs_gpiod references with function call 2023-03-11 12:34:01 +00:00
spi-davinci.c spi: Replace all spi->chip_select and spi->cs_gpiod references with function call 2023-03-11 12:34:01 +00:00
spi-dln2.c spi: Replace all spi->chip_select and spi->cs_gpiod references with function call 2023-03-11 12:34:01 +00: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: Replace all spi->chip_select and spi->cs_gpiod references with function call 2023-03-11 12:34:01 +00:00
spi-dw-dma.c spi: dw-dma: decrease reference count in dw_spi_dma_init_mfld() 2022-11-16 13:43:03 +00:00
spi-dw-mmio.c spi: dw: Replace spi->chip_select references with function calls 2023-05-16 10:15:06 +09:00
spi-dw-pci.c spi: dw: Put the driver entities naming in order 2021-11-16 14:30:05 +00:00
spi-dw.h spi: dw: Add support for Intel Thunder Bay SPI controller 2022-07-13 13:32:32 +01:00
spi-ep93xx.c spi: ep93xx: Convert to platform remove callback returning void 2023-03-06 12:31:23 +00:00
spi-falcon.c spi: Replace all spi->chip_select and spi->cs_gpiod references with function call 2023-03-11 12:34:01 +00:00
spi-fsi.c spi: Replace all spi->chip_select and spi->cs_gpiod references with function call 2023-03-11 12:34:01 +00:00
spi-fsl-cpm.c spi: fsl-cpm: Use 16 bit mode for large transfers with even size 2023-04-05 12:33:34 +01:00
spi-fsl-cpm.h
spi-fsl-dspi.c spi: fsl-dspi: avoid SCK glitches with continuous transfers 2023-06-06 16:49:20 +01:00
spi-fsl-espi.c spi: Replace all spi->chip_select and spi->cs_gpiod references with function call 2023-03-11 12:34:01 +00:00
spi-fsl-lib.c
spi-fsl-lib.h
spi-fsl-lpspi.c spi: lpspi: disable lpspi module irq in DMA mode 2023-05-23 19:22:45 +01:00
spi-fsl-qspi.c spi: Replace all spi->chip_select and spi->cs_gpiod references with function call 2023-03-11 12:34:01 +00:00
spi-fsl-spi.c spi: fsl-spi: No need to check transfer length versus word size 2023-04-05 12:33:36 +01:00
spi-fsl-spi.h
spi-geni-qcom.c spi: spi-geni-qcom: Select FIFO mode for chip select 2023-05-11 10:18:35 +09:00
spi-gpio.c spi: Replace all spi->chip_select and spi->cs_gpiod references with function call 2023-03-11 12:34:01 +00:00
spi-gxp.c spi: Replace all spi->chip_select and spi->cs_gpiod references with function call 2023-03-11 12:34:01 +00:00
spi-hisi-kunpeng.c spi: hisi-kunpeng: Convert to platform remove callback returning void 2023-03-06 12:31:29 +00:00
spi-hisi-sfc-v3xx.c spi: Replace all spi->chip_select and spi->cs_gpiod references with function call 2023-03-11 12:34:01 +00:00
spi-img-spfi.c spi: Replace all spi->chip_select and spi->cs_gpiod references with function call 2023-03-11 12:34:01 +00:00
spi-imx.c spi: imx: Use devm_platform_get_and_ioremap_resource() 2023-04-04 12:46:54 +01:00
spi-ingenic.c spi: Replace all spi->chip_select and spi->cs_gpiod references with function call 2023-03-11 12:34:01 +00:00
spi-intel-pci.c spi: intel-pci: Add support for Meteor Lake-S SPI serial flash 2023-03-31 12:54:07 +01:00
spi-intel-platform.c mtd: spi-nor: intel-spi: Convert to SPI MEM 2022-02-14 12:53:09 +00:00
spi-intel.c spi: Replace all spi->chip_select and spi->cs_gpiod references with function call 2023-03-11 12:34:01 +00:00
spi-intel.h mtd: spi-nor: intel-spi: Convert to SPI MEM 2022-02-14 12:53:09 +00:00
spi-iproc-qspi.c spi: iproc-qspi: Convert to platform remove callback returning void 2023-03-06 12:31:31 +00:00
spi-jcore.c spi: Replace all spi->chip_select and spi->cs_gpiod references with function call 2023-03-11 12:34:01 +00:00
spi-lantiq-ssc.c spi: Replace all spi->chip_select and spi->cs_gpiod references with function call 2023-03-11 12:34:01 +00:00
spi-lm70llp.c
spi-loopback-test.c spi: spi-loopback-test: Add module param for iteration length 2023-04-13 11:42:20 +01:00
spi-lp8841-rtc.c
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: Replace all spi->chip_select and spi->cs_gpiod references with function call 2023-03-11 12:34:01 +00: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: Convert to platform remove callback returning void 2023-03-06 12:31:34 +00:00
spi-microchip-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-mpc52xx-psc.c spi: mpc5xxx-psc: Consistently use device property APIs 2023-03-07 13:58:34 +00: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: Replace all spi->chip_select and spi->cs_gpiod references with function call 2023-03-11 12:34:01 +00:00
spi-mt65xx.c spi: mt65xx: make sure operations completed before unloading 2023-05-23 23:19:55 +01:00
spi-mt7621.c spi: Replace all spi->chip_select and spi->cs_gpiod references with function call 2023-03-11 12:34:01 +00:00
spi-mtk-nor.c spi: mtk-nor: Convert to platform remove callback returning void 2023-03-06 21:17:45 +00:00
spi-mtk-snfi.c spi: mtk-snfi: Convert to platform remove callback returning void 2023-03-06 21:17:46 +00: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: Replace all spi->chip_select and spi->cs_gpiod references with function call 2023-03-11 12:34:01 +00:00
spi-npcm-fiu.c spi: Replace all spi->chip_select and spi->cs_gpiod references with function call 2023-03-11 12:34:01 +00: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: spi-nxp-fspi: use DLL calibration when clock rate > 100MHz 2023-03-22 13:17:43 +00: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: Replace all spi->chip_select and spi->cs_gpiod references with function call 2023-03-11 12:34:01 +00:00
spi-omap2-mcspi.c spi: omap2-mcspi: Use devm_platform_get_and_ioremap_resource() 2023-03-27 12:42:32 +01:00
spi-orion.c spi: orion: Use devm_platform_get_and_ioremap_resource() 2023-03-27 12:42:33 +01:00
spi-pci1xxxx.c spi: mchp-pci1xxxx: Fix improper implementation of disabling chip select lines 2023-04-05 12:33:28 +01:00
spi-pic32-sqi.c spi: Replace all spi->chip_select and spi->cs_gpiod references with function call 2023-03-11 12:34:01 +00:00
spi-pic32.c spi: pic32: Use devm_platform_get_and_ioremap_resource() 2023-03-27 12:42:34 +01:00
spi-pl022.c spi: Replace all spi->chip_select and spi->cs_gpiod references with function call 2023-03-11 12:34:01 +00:00
spi-ppc4xx.c spi: ppc4xx: Convert to platform remove callback returning void 2023-03-06 21:17:57 +00:00
spi-pxa2xx-dma.c
spi-pxa2xx-pci.c spi: pxa2xx-pci: Constify struct pxa_spi_info variables 2022-02-28 12:10:27 +00:00
spi-pxa2xx.c spi: pxa2xx: Mark OF related data as maybe unused 2023-03-13 14:09:11 +00:00
spi-pxa2xx.h spi: pxa2xx: Get rid of unused ->cs_control() 2021-11-29 12:19:59 +00:00
spi-qcom-qspi.c spi: spi-qcom-qspi: Support pinctrl sleep states 2023-03-28 01:26:10 +01:00
spi-qup.c spi: qup: Request DMA before enabling clocks 2023-05-30 13:43:31 +01:00
spi-rb4xx.c spi: Replace all spi->chip_select and spi->cs_gpiod references with function call 2023-03-11 12:34:01 +00:00
spi-realtek-rtl.c
spi-rockchip-sfc.c spi: Updates for v6.4 2023-04-27 11:02:26 -07:00
spi-rockchip.c spi: Replace all spi->chip_select and spi->cs_gpiod references with function call 2023-03-11 12:34:01 +00:00
spi-rpc-if.c spi: rpc-if: Convert to platform remove callback returning void 2023-03-06 21:18:02 +00:00
spi-rspi.c spi: rspi: Mark OF related data as maybe unused 2023-03-13 14:09:15 +00:00
spi-s3c64xx.c spi: Replace all spi->chip_select and spi->cs_gpiod references with function call 2023-03-11 12:34:01 +00:00
spi-sc18is602.c spi: sc18is602: Mark OF related data as maybe unused 2023-03-13 14:09:14 +00:00
spi-sh-hspi.c spi: sh-hspi: Convert to platform remove callback returning void 2023-03-06 21:18:06 +00:00
spi-sh-msiof.c spi: struct spi_device constification 2023-03-13 18:19:31 +00:00
spi-sh-sci.c spi: Replace all spi->chip_select and spi->cs_gpiod references with function call 2023-03-11 12:34:01 +00:00
spi-sh.c spi: sh: Convert to platform remove callback returning void 2023-03-06 21:18:08 +00:00
spi-sifive.c spi: Replace all spi->chip_select and spi->cs_gpiod references with function call 2023-03-11 12:34:01 +00:00
spi-slave-mt27xx.c spi: slave-mt27xx: Convert to platform remove callback returning void 2023-03-06 21:18:10 +00:00
spi-slave-system-control.c spi: make remove callback a void function 2022-02-09 13:00:45 +00:00
spi-slave-time.c spi: make remove callback a void function 2022-02-09 13:00:45 +00:00
spi-sn-f-ospi.c spi: f_ospi: Add missing spi_mem_default_supports_op() helper 2023-03-22 13:17:43 +00:00
spi-sprd-adi.c spi: sprd-adi: Use devm_platform_get_and_ioremap_resource() 2023-03-27 12:42:35 +01:00
spi-sprd.c spi: sprd: Use devm_platform_get_and_ioremap_resource() 2023-03-27 12:42:35 +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: Replace all spi->chip_select and spi->cs_gpiod references with function call 2023-03-11 12:34:01 +00:00
spi-stm32.c spi: stm32: Use devm_platform_get_and_ioremap_resource() 2023-04-04 12:46:55 +01: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: Replace all spi->chip_select and spi->cs_gpiod references with function call 2023-03-11 12:34:01 +00: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: Replace all spi->chip_select and spi->cs_gpiod references with function call 2023-03-11 12:34:01 +00:00
spi-tegra20-slink.c spi: Replace all spi->chip_select and spi->cs_gpiod references with function call 2023-03-11 12:34:01 +00:00
spi-tegra114.c spi: tegra114: Use devm_platform_get_and_ioremap_resource() 2023-04-04 12:46:56 +01:00
spi-tegra210-quad.c spi: tegra210-quad: Enable TPM wait polling 2023-04-21 14:37:04 +01:00
spi-test.h
spi-ti-qspi.c spi: Replace all spi->chip_select and spi->cs_gpiod references with function call 2023-03-11 12:34:01 +00:00
spi-tle62x0.c spi: make remove callback a void function 2022-02-09 13:00:45 +00:00
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: Replace all spi->chip_select and spi->cs_gpiod references with function call 2023-03-11 12:34:01 +00:00
spi-xcomm.c spi: Replace all spi->chip_select and spi->cs_gpiod references with function call 2023-03-11 12:34:01 +00: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: xtensa-xtfpga: Convert to platform remove callback returning void 2023-03-06 21:18:26 +00:00
spi-zynq-qspi.c spi: Replace all spi->chip_select and spi->cs_gpiod references with function call 2023-03-11 12:34:01 +00:00
spi-zynqmp-gqspi.c spi: Replace all spi->chip_select and spi->cs_gpiod references with function call 2023-03-11 12:34:01 +00:00
spi.c Char/Misc drivers for 6.4-rc1 2023-04-27 12:07:50 -07:00
spidev.c Driver core changes for 6.4-rc1 2023-04-27 11:53:57 -07:00