Repository navigation
BACKPORT: spi: geni-qcom: Fix sub-byte transfer packing and length calculation - #1616
Open
somesh77qc wants to merge 1 commit into
Open
somesh77qc wants to merge 1 commit into
somesh77qc wants to merge 1 commit into
Conversation
…lculation On iq-9075-evk, short four-bit SPI loopback transfers can time out immediately after boot. The failure is reproduced with spidev_test: ./spidev_test -D /dev/spidev0.0 -s 2500000 -b 4 -l -I 10 -v The test reports "can't send spi message: Connection timed out", with the following kernel messages: [ 732.730335] spidev spi0.0: SPI transfer timed out [ 732.735216] geni_spi 880000.spi: Can't set CS when prev xfer running [ 732.742882] spi_master spi0: failed to transfer one message from queue [ 732.749619] spi_master spi0: noqueue transfer failed At BPW 4, the driver requests eight protocol words per 32-bit FIFO entry. The GENI helper needs one packing vector per sub-byte word but only supports four vectors, so it returns without programming the packing registers. This leaves the transfer dependent on the previous packing configuration. The driver also assumes that a buffer byte contains two four-bit words. Linux SPI buffers store each sub-byte word in a separate byte, so the programmed transfer length can exceed the available data. Use byte-sized packing slots for sub-byte transfers and derive word counts from spi_bpw_to_bytes(). Share the packing count across hardware configuration, FIFO accounting and DMA selection. Account for storage padding in the last received word, and drain leftover FIFO entries without relying on a cached word width. Link: https://lore.kernel.org/all/20261118-spi-bpw-fix-v1-1-e475586ca8e8@oss.qualcomm.com/ Fixes: 561de45 ("spi: spi-geni-qcom: Add SPI driver support for GENI based QUP") Signed-off-by: Somesh Dey <somesh.dey@oss.qualcomm.com>
somesh77qc
requested review from
a team,
Sibi Sankar (QuinAsura),
jingyiwang42 and
Mukesh Ojha (mukeshojha-linux)
December 2, 2026 16:03
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
On iq-9075-evk, short four-bit SPI loopback transfers can time out immediately after boot. The failure is reproduced with spidev_test:
./spidev_test -D /dev/spidev0.0 -s 2500000 -b 4 -l -I 10 -v
The test reports "can't send spi message: Connection timed out", with the following kernel messages:
[ 732.730335] spidev spi0.0: SPI transfer timed out
[ 732.735216] geni_spi 880000.spi: Can't set CS when prev xfer running
[ 732.742882] spi_master spi0: failed to transfer one message from queue
[ 732.749619] spi_master spi0: noqueue transfer failed
At BPW 4, the driver requests eight protocol words per 32-bit FIFO entry. The GENI helper needs one packing vector per sub-byte word but only supports four vectors, so it returns without programming the packing registers. This leaves the transfer dependent on the previous packing configuration.
The driver also assumes that a buffer byte contains two four-bit words. Linux SPI buffers store each sub-byte word in a separate byte, so the programmed transfer length can exceed the available data.
Use byte-sized packing slots for sub-byte transfers and derive word counts from spi_bpw_to_bytes(). Share the packing count across hardware configuration, FIFO accounting and DMA selection. Account for storage padding in the last received word, and drain leftover FIFO entries without relying on a cached word width.
Link: https://lore.kernel.org/all/20261118-spi-bpw-fix-v1-1-e475586ca8e8@oss.qualcomm.com/
Fixes: 561de45 ("spi: spi-geni-qcom: Add SPI driver support for GENI based QUP")
CRs-Fixed: 4457566