Compare

cf1f186e08dadb5abc4410d10fe3ada7ebf801ae..8980bc573ae2d2b9d86d76aeb86c76e1597070bf

spi: tegra114: assert CS GPIO for every transfer in a message

The driver provides its own transfer_one_message() and therefore drives
the chip-select GPIO itself rather than through the SPI core. The GPIO is
asserted only in the is_first_of_msg path of
tegra_spi_setup_transfer_one(), but tegra_spi_transfer_end() deasserts it
whenever a transfer has cs_change set. For a multi-transfer message whose
earlier transfers request cs_change -- for example a register read that
sends the address in one transfer and clocks the data back in the next --
the CS GPIO is released after the first transfer and never re-asserted,
so the remaining transfers are clocked with chip-select inactive and the
peripheral never drives the bus.

This was observed with an ADIS16470 IMU (adis16475 driver), whose
register read is a two-transfer, cs_change-framed exchange: a logic
analyzer showed the data frame clocked with CS high, and the driver read
0 while the device drove 0x4056 on the wire.

Re-assert the CS GPIO for every transfer so that multi-transfer messages
keep chip-select active across the whole message. gpiod_set_value() is
idempotent and polarity-aware, so this is a no-op for the first transfer
and for messages that keep CS asserted throughout.

Fixes: 63c1440596ff ("spi: tegra114: add support for gpio based CS")
Signed-off-by: Carlos Jones Jr <carlosjr.jones@analog.com>
Link: https://patch.msgid.link/20261002085540.1625-1-carlosjr.jones@analog.com
Signed-off-by: Mark Brown <broonie@kernel.org>

Carlos Jones Jr <carlosjr.jones@analog.com> · 2026-10-02 08:55 UTC · committed by Mark Brown

Browse files
2 files changed, +8 −4
modified arch/x86/events/intel/uncore_snbep.c
@@ -474,9 +474,6 @@
474 474 /* DMR */
475 475 #define DMR_IMH1_HIOP_MMIO_BASE 0x1ffff6ae7000
476 476 #define DMR_HIOP_MMIO_SIZE 0x8000
477 - #define DMR_CXLCM_PMON_CTL_INVERT BIT(21)
478 - #define DMR_CXLCM_PMON_RAW_EVENT_MASK (GENERIC_PMON_RAW_EVENT_MASK | \
479 - DMR_CXLCM_PMON_CTL_INVERT)
480 477 #define DMR_CXLCM_EVENT_MASK_EXT 0xf
481 478 #define DMR_HAMVF_EVENT_MASK_EXT 0xffffffff
482 479 #define DMR_PCIE4_EVENT_MASK_EXT 0xffffff
@@ -6699,7 +6696,7 @@ static struct event_constraint dmr_uncore_cxlcm_constraints[] = {
6699 6696
6700 6697 static struct intel_uncore_type dmr_uncore_cxlcm = {
6701 6698 .name = "cxlcm",
6702 - .event_mask = DMR_CXLCM_PMON_RAW_EVENT_MASK,
6699 + .event_mask = GENERIC_PMON_RAW_EVENT_MASK,
6703 6700 .event_mask_ext = DMR_CXLCM_EVENT_MASK_EXT,
6704 6701 .constraints = dmr_uncore_cxlcm_constraints,
6705 6702 .format_group = &dmr_cxlcm_uncore_format_group,
modified drivers/spi/spi-tegra114.c
@@ -859,6 +859,13 @@ static u32 tegra_spi_setup_transfer_one(struct spi_device *spi,
859 859 command1 |= SPI_BIT_LENGTH(bits_per_word - 1);
860 860 }
861 861
862 + /*
863 + * Re-assert the CS GPIO for every transfer: transfer_end() drops it
864 + * on cs_change, and the assert above only covers is_first_of_msg.
865 + */
866 + if (spi_get_csgpiod(spi, 0))
867 + gpiod_set_value(spi_get_csgpiod(spi, 0), 1);
868 +
862 869 return command1;
863 870 }
864 871