Compare
448e76cbdc6652ccd3ba337b7a6e1f028859f2ed..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
2 files changed,
+8
−10
modified drivers/gpu/drm/xe/xe_bo.c
| @@ -330,12 +330,6 @@ static void xe_evict_flags(struct ttm_buffer_object *tbo, | |||
| 330 | 330 | return; | |
| 331 | 331 | } | |
| 332 | 332 | ||
| 333 | - | /* No resource: nothing is placed/mapped, so there is nothing to evict. */ | |
| 334 | - | if (!tbo->resource) { | |
| 335 | - | placement->num_placement = 0; | |
| 336 | - | return; | |
| 337 | - | } | |
| 338 | - | ||
| 339 | 333 | bo = ttm_to_xe_bo(tbo); | |
| 340 | 334 | if (bo->flags & XE_BO_FLAG_CPU_ADDR_MIRROR) { | |
| 341 | 335 | *placement = sys_placement; | |
| @@ -950,8 +944,6 @@ static int xe_bo_move_notify(struct xe_bo *bo, | |||
| 950 | 944 | * | |
| 951 | 945 | * Transfers pages between shrinkable and purgeable buckets when the BO | |
| 952 | 946 | * purgeable state changes. Called automatically from xe_bo_set_purgeable_state(). | |
| 953 | - | * For pinned BOs, whose pages are not accounted, only the purgeable flag is | |
| 954 | - | * updated, so that the correct bucket is used when the BO is unpinned. | |
| 955 | 947 | */ | |
| 956 | 948 | static void xe_bo_set_purgeable_shrinker(struct xe_bo *bo, | |
| 957 | 949 | enum xe_madv_purgeable_state new_state) | |
| @@ -968,8 +960,7 @@ static void xe_bo_set_purgeable_shrinker(struct xe_bo *bo, | |||
| 968 | 960 | return; | |
| 969 | 961 | ||
| 970 | 962 | xe_tt = container_of(tt, struct xe_ttm_tt, ttm); | |
| 971 | - | /* Pinned bos are not accounted. Only update the purgeable flag. */ | |
| 972 | - | tt_pages = xe_bo_is_pinned(bo) ? 0 : tt->num_pages; | |
| 963 | + | tt_pages = tt->num_pages; | |
| 973 | 964 | ||
| 974 | 965 | if (!xe_tt->purgeable && new_state == XE_MADV_PURGEABLE_DONTNEED) { | |
| 975 | 966 | xe_tt->purgeable = true; | |
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 | ||