Revision 6af8ae321a801a4e20183454c65eb0d23069d8ac authored by Phil Elwell on 28 January 2021, 11:30:04 UTC, committed by Phil Elwell on 28 January 2021, 11:46:41 UTC
A relatively recent commit ([1]) contained optimisation for the PIO
SPI FIFO-filling functions. The commit message includes the phrase
"[t]he blind and counted loops are always called with nonzero count".
This is technically true, but it is still possible for count to become
zero before the loop is entered - if tfr->len is zero. Moving the loop
exit condition to the end of the loop saves a few cycles, but results
in a near-infinite loop should the revised count be zero on entry.

Strangely, zero-lengthed transfers aren't filtered by the SPI framework
and, even more strangely, the Python3 spidev library is triggering them
for no obvious reason.

Avoid the problem completely by bailing out of the main transfer
function early if trf->len is zero, although there may be a case for
moving the mitigation into the framework.

See: https://github.com/raspberrypi/linux/issues/4100

Signed-off-by: Phil Elwell <phil@raspberrypi.com>

[1] 26751de25d25 ("spi: bcm2835: Micro-optimise FIFO loops")
1 parent c5f51df
Raw File
Kconfig.socs
menu "SoC selection"

config SOC_SIFIVE
	bool "SiFive SoCs"
	select SERIAL_SIFIVE if TTY
	select SERIAL_SIFIVE_CONSOLE if TTY
	select CLK_SIFIVE
	select CLK_SIFIVE_FU540_PRCI
	select SIFIVE_PLIC
	help
	  This enables support for SiFive SoC platform hardware.

config SOC_VIRT
	bool "QEMU Virt Machine"
	select CLINT_TIMER if RISCV_M_MODE
	select POWER_RESET
	select POWER_RESET_SYSCON
	select POWER_RESET_SYSCON_POWEROFF
	select GOLDFISH
	select RTC_DRV_GOLDFISH if RTC_CLASS
	select SIFIVE_PLIC
	help
	  This enables support for QEMU Virt Machine.

config SOC_KENDRYTE
	bool "Kendryte K210 SoC"
	depends on !MMU
	select CLINT_TIMER if RISCV_M_MODE
	select SERIAL_SIFIVE if TTY
	select SERIAL_SIFIVE_CONSOLE if TTY
	select SIFIVE_PLIC
	help
	  This enables support for Kendryte K210 SoC platform hardware.

config SOC_KENDRYTE_K210_DTB
	def_bool y
	depends on SOC_KENDRYTE_K210_DTB_BUILTIN

config SOC_KENDRYTE_K210_DTB_BUILTIN
	bool "Builtin device tree for the Kendryte K210"
	depends on SOC_KENDRYTE
	default y
	select OF
	select BUILTIN_DTB
	select SOC_KENDRYTE_K210_DTB
	help
	  Builds a device tree for the Kendryte K210 into the Linux image.
	  This option should be selected if no bootloader is being used.
	  If unsure, say Y.

endmenu
back to top