spi: tegra114: Preserve SPI mode bits in def_command1_reg
Subsystems (3)
PATCH 1/1 spi: tegra114: Preserve SPI mode bits in def_command1_reg
The COMMAND1 register bits [29:28] set the SPI mode, which controls the clock idle level. When a transfer ends, tegra_spi_transfer_end() writes def_command1_reg back to restore the default state, but this register value currently lacks the mode bits. This results in the clock always being configured as idle low, breaking devices that need it high.
Fix this by storing the mode bits in def_command1_reg during setup, to prevent this field from always being cleared.
--- drivers/spi/spi-tegra114.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/spi/spi-tegra114.c +3 -0
@@ -978,11 +978,14 @@ static int tegra_spi_setup(struct spi_device *spi)if (spi_get_csgpiod (spi,0 ))gpiod_set_value (spi_get_csgpiod (spi,0 ),0 ); +/* Update default register to include CS polarity and SPI mode */ val = tspi->def_command1_reg;if (spi->mode &SPI_CS_HIGH ) val &= ~SPI_CS_POL_INACTIVE (spi_get_chipselect (spi,0 ));else val |=SPI_CS_POL_INACTIVE (spi_get_chipselect (spi,0 )); + val &= ~SPI_CONTROL_MODE_MASK ; + val |=SPI_MODE_SEL (spi->mode &0x3 ); tspi->def_command1_reg = val;tegra_spi_writel (tspi, tspi->def_command1_reg,SPI_COMMAND1 );spin_unlock_irqrestore (&tspi->lock, flags);
Signature · 1 line
2.17.1
Mark Brown
maintainerQuoted 8 lines · Vishwaroop A
The COMMAND1 register bits [29:28] set the SPI mode, which controls the clock idle level. When a transfer ends,
tegra_spi_transfer_end()writesdef_command1_regback to restore the default state, but this register value currently lacks the mode bits. This results in the clock always being configured as idle low, breaking devices that need it high.[...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-next
Thanks!
[1/1] spi: tegra114: Preserve SPI mode bits in def_command1_reg
commit: a0a75b40c919b9f6d3a0b6c978e6ccf344c1be5a
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks,
Mark