Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'spi-fix-v6.2-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi

Pull spi fix from Mark Brown:
"One driver specific change here which handles the case where a SPI
device for some reason tries to change the bus speed during a message
on fsl_spi hardware, this should be very unusual"

* tag 'spi-fix-v6.2-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi:
spi: fsl_spi: Don't change speed while chipselect is active

+16 -3
+16 -3
drivers/spi/spi-fsl-spi.c
··· 333 333 { 334 334 struct mpc8xxx_spi *mpc8xxx_spi = spi_controller_get_devdata(ctlr); 335 335 struct spi_transfer *t; 336 + struct spi_transfer *first; 337 + 338 + first = list_first_entry(&m->transfers, struct spi_transfer, 339 + transfer_list); 336 340 337 341 /* 338 342 * In CPU mode, optimize large byte transfers to use larger 339 343 * bits_per_word values to reduce number of interrupts taken. 344 + * 345 + * Some glitches can appear on the SPI clock when the mode changes. 346 + * Check that there is no speed change during the transfer and set it up 347 + * now to change the mode without having a chip-select asserted. 340 348 */ 341 - if (!(mpc8xxx_spi->flags & SPI_CPM_MODE)) { 342 - list_for_each_entry(t, &m->transfers, transfer_list) { 349 + list_for_each_entry(t, &m->transfers, transfer_list) { 350 + if (t->speed_hz != first->speed_hz) { 351 + dev_err(&m->spi->dev, 352 + "speed_hz cannot change during message.\n"); 353 + return -EINVAL; 354 + } 355 + if (!(mpc8xxx_spi->flags & SPI_CPM_MODE)) { 343 356 if (t->len < 256 || t->bits_per_word != 8) 344 357 continue; 345 358 if ((t->len & 3) == 0) ··· 361 348 t->bits_per_word = 16; 362 349 } 363 350 } 364 - return 0; 351 + return fsl_spi_setup_transfer(m->spi, first); 365 352 } 366 353 367 354 static int fsl_spi_transfer_one(struct spi_controller *controller,