WSL2-Linux-Kernel/drivers/spi
Stefan Wahren 4f8c8edede spi: spi-fsl-lpspi: Fix scldiv calculation
[ Upstream commit 730bbfaf7d4890bd99e637db7767dc68cfeb24e7 ]

The effective SPI clock frequency should never exceed speed_hz
otherwise this might result in undefined behavior of the SPI device.

Currently the scldiv calculation could violate this constraint.
For the example parameters perclk_rate = 24 MHz and speed_hz = 7 MHz,
the function fsl_lpspi_set_bitrate will determine perscale = 0 and
scldiv = 1, which is a effective SPI clock of 8 MHz.

So fix this by rounding up the quotient of perclk_rate and speed_hz.
While this never change within the loop, we can pull this out.

Fixes: 5314987de5 ("spi: imx: add lpspi bus driver")
Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
Link: https://patch.msgid.link/20240804113611.83613-1-wahrenst@gmx.net
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-08-19 05:45:42 +02:00
..
Kconfig spi: spi-zynqmp-gqspi: fix driver kconfig dependencies 2024-01-25 14:52:33 -08:00
Makefile
atmel-quadspi.c spi: atmel-quadspi: Fix the buswidth adjustment between spi-mem and controller 2022-04-27 14:39:02 +02:00
internals.h
spi-altera-core.c
spi-altera-dfl.c spi: spi-altera-dfl: Fix an error handling path 2022-08-17 14:23:06 +02:00
spi-altera-platform.c
spi-amd.c spi: amd: Limit max transfer and message size 2022-07-21 21:24:16 +02:00
spi-ar934x.c
spi-armada-3700.c spi: change clk_disable_unprepare to clk_unprepare 2021-12-29 12:28:39 +01:00
spi-at91-usart.c
spi-ath79.c
spi-atmel.c
spi-au1550.c
spi-axi-spi-engine.c
spi-bcm-qspi.c spi: bcm-qspi: fix SFDP BFPT read by usig mspi read 2024-02-23 08:54:35 +01:00
spi-bcm-qspi.h
spi-bcm63xx-hsspi.c spi: bcm63xx-hsspi: Fix multi-bit mode setting 2023-03-10 09:39:30 +01:00
spi-bcm63xx.c spi: bcm63xx: fix max prepend length 2023-07-27 08:46:58 +02:00
spi-bcm2835.c spi: bcm2835: bcm2835_spi_handle_err(): fix NULL pointer deref for non DMA transfers 2022-07-29 17:25:24 +02:00
spi-bcm2835aux.c
spi-bitbang-txrx.h
spi-bitbang.c
spi-brcmstb-qspi.c
spi-butterfly.c
spi-cadence-quadspi.c spi: cadence-quadspi: fix suspend-resume implementations 2023-05-11 23:00:33 +09:00
spi-cadence.c
spi-cavium-octeon.c
spi-cavium-thunderx.c
spi-cavium.c
spi-cavium.h
spi-clps711x.c
spi-coldfire-qspi.c
spi-davinci.c
spi-dln2.c
spi-dw-bt1.c spi: dw: Fix PM disable depth imbalance in dw_spi_bt1_probe 2022-10-26 12:34:45 +02:00
spi-dw-core.c spi: dw: Round of n_bytes to power of 2 2023-07-23 13:46:50 +02:00
spi-dw-dma.c spi: dw-dma: decrease reference count in dw_spi_dma_init_mfld() 2022-12-02 17:41:03 +01:00
spi-dw-mmio.c
spi-dw-pci.c
spi-dw.h
spi-ep93xx.c
spi-falcon.c
spi-fsi.c
spi-fsl-cpm.c spi: fsl-cpm: Use 16 bit mode for large transfers with even size 2023-05-30 13:55:29 +01:00
spi-fsl-cpm.h
spi-fsl-dspi.c spi: fsl-dspi: avoid SCK glitches with continuous transfers 2023-06-21 15:59:16 +02:00
spi-fsl-espi.c
spi-fsl-lib.c
spi-fsl-lib.h
spi-fsl-lpspi.c spi: spi-fsl-lpspi: Fix scldiv calculation 2024-08-19 05:45:42 +02:00
spi-fsl-qspi.c spi: spi-fsl-qspi: check return value after calling platform_get_resource_byname() 2022-06-09 10:22:55 +02:00
spi-fsl-spi.c spi: fsl-cpm: Use 16 bit mode for large transfers with even size 2023-05-30 13:55:29 +01:00
spi-fsl-spi.h
spi-geni-qcom.c spi: spi-geni-qcom: Correct CS_TOGGLE bit in SPI_TRANS_CFG 2023-07-23 13:46:49 +02:00
spi-gpio.c spi: spi-gpio: Don't set MOSI as an input if not 3WIRE mode 2022-12-31 13:14:18 +01:00
spi-hisi-kunpeng.c spi: hisi-kunpeng: Delete the dump interface of data registers in debugfs 2024-05-17 11:50:47 +02:00
spi-hisi-sfc-v3xx.c spi: hisi-sfc-v3xx: Return IRQ_NONE if no interrupts were detected 2024-03-01 13:21:44 +01:00
spi-img-spfi.c spi: img-spfi: Fix pm_runtime_get_sync() error checking 2022-06-09 10:22:48 +02:00
spi-imx.c spi: imx: Don't expect DMA for i.MX{25,35,50,51,53} cspi devices 2024-07-27 10:46:14 +02:00
spi-iproc-qspi.c
spi-jcore.c
spi-lantiq-ssc.c
spi-lm70llp.c
spi-loopback-test.c
spi-lp8841-rtc.c
spi-mem.c
spi-meson-spicc.c spi: meson-spicc: do not rely on busy flag in pow2 clk ops 2022-10-26 12:34:42 +02:00
spi-meson-spifc.c spi: spi-meson-spifc: Add missing pm_runtime_disable() in meson_spifc_probe 2022-01-27 11:03:59 +01:00
spi-mpc52xx-psc.c
spi-mpc52xx.c
spi-mpc512x-psc.c
spi-mt65xx.c spi: spi-mt65xx: Fix NULL pointer access in interrupt handler 2024-03-26 18:21:37 -04:00
spi-mt7621.c spi: mt7621: Fix an error message in mt7621_spi_probe() 2022-10-26 12:34:40 +02:00
spi-mtk-nor.c spi: spi-mtk-nor: initialize spi controller after resume 2022-04-27 14:38:52 +02:00
spi-mux.c spi: mux: set ctlr->bits_per_word_mask 2024-07-27 10:46:14 +02:00
spi-mxic.c spi: mxic: Fix the transmit path 2022-04-08 14:22:53 +02:00
spi-mxs.c
spi-npcm-fiu.c spi: npcm-fiu: Fix UMA reads when dummy.nbytes == 0 2023-11-08 17:26:47 +01:00
spi-npcm-pspi.c
spi-nxp-fspi.c spi: nxp-fspi: use the correct ioremap function 2023-11-20 11:08:17 +01:00
spi-oc-tiny.c
spi-omap-100k.c spi/omap100k:Fix PM disable depth imbalance in omap1_spi100k_probe 2022-10-26 12:34:46 +02:00
spi-omap-uwire.c
spi-omap2-mcspi.c
spi-orion.c
spi-pic32-sqi.c
spi-pic32.c
spi-pl022.c
spi-ppc4xx.c spi: ppc4xx: Drop write-only variable 2024-02-23 08:55:02 +01:00
spi-pxa2xx-dma.c
spi-pxa2xx-pci.c spi: pxa2xx-pci: Balance reference count for PCI DMA device 2022-04-08 14:23:07 +02:00
spi-pxa2xx.c
spi-pxa2xx.h
spi-qcom-qspi.c
spi-qup.c spi: qup: Request DMA before enabling clocks 2023-06-14 11:13:00 +02:00
spi-rb4xx.c
spi-realtek-rtl.c
spi-rockchip-sfc.c spi: spi-rockchip: Fix missing unwind goto in rockchip_sfc_probe() 2023-04-26 13:51:49 +02:00
spi-rockchip.c spi: rockchip: fix missing error on unsupported SPI_CS_HIGH 2022-06-09 10:22:50 +02:00
spi-rpc-if.c spi: spi-rpc-if: Check return value of rpcif_sw_init() 2021-11-18 19:16:42 +01:00
spi-rspi.c spi: spi-rspi: Fix PIO fallback on RZ platforms 2022-08-17 14:23:05 +02:00
spi-s3c24xx-regs.h
spi-s3c24xx.c
spi-s3c64xx.c spi: s3c64xx: Fix large transfers with DMA 2022-10-26 12:34:47 +02:00
spi-sc18is602.c
spi-sh-hspi.c
spi-sh-msiof.c spi: sh-msiof: avoid integer overflow in constants 2024-03-01 13:21:45 +01:00
spi-sh-sci.c
spi-sh.c
spi-sifive.c
spi-slave-mt27xx.c
spi-slave-system-control.c
spi-slave-time.c
spi-sprd-adi.c
spi-sprd.c
spi-st-ssc4.c
spi-stm32-qspi.c spi: stm32-qspi: Fix wait_cmd timeout in APM mode 2022-06-09 10:22:36 +02:00
spi-stm32.c spi: stm32: Don't warn about spurious interrupts 2024-06-16 13:39:51 +02:00
spi-sun4i.c
spi-sun6i.c spi: sun6i: fix race between DMA RX transfer completion and RX FIFO drain 2023-10-06 13:18:15 +02:00
spi-synquacer.c spi: synquacer: Fix timeout handling in synquacer_spi_transfer_one() 2023-03-10 09:39:31 +01:00
spi-tegra20-sflash.c spi: tegra20-sflash: fix to check return value of platform_get_irq() in tegra_sflash_probe() 2023-09-19 12:22:32 +02:00
spi-tegra20-slink.c spi: tegra: Fix missing IRQ check in tegra_slink_probe() 2023-11-20 11:08:16 +01:00
spi-tegra114.c spi: tegra114: Add missing IRQ check in tegra_spi_probe 2022-04-08 14:23:05 +02:00
spi-tegra210-quad.c spi: tegra210-quad: Fix missin IRQ check in tegra_qspi_probe 2022-04-08 14:23:06 +02:00
spi-test.h
spi-ti-qspi.c spi: spi-ti-qspi: Fix return value handling of wait_for_completion_timeout 2022-06-09 10:22:46 +02:00
spi-tle62x0.c
spi-topcliff-pch.c
spi-uniphier.c spi: uniphier: fix reference count leak in uniphier_spi_probe() 2022-02-08 18:34:08 +01:00
spi-xcomm.c
spi-xilinx.c
spi-xlp.c
spi-xtensa-xtfpga.c
spi-zynq-qspi.c spi: spi-zynq-qspi: Fix a NULL pointer dereference in zynq_qspi_exec_mem_op() 2022-03-02 11:48:01 +01:00
spi-zynqmp-gqspi.c spi: zynqmp-gqspi: fix clock imbalance on probe failure 2023-10-10 21:59:04 +02:00
spi.c spi: Don't mark message DMA mapped when no transfer in it is 2024-06-16 13:39:49 +02:00
spidev.c spi: spidev: Add missing spi_device_id for bh2228fv 2024-08-19 05:45:42 +02:00