Skip to content

Commit ed44935

Browse files
committed
Merge tag 'spi-fix-v6.9-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi
Pull spi fixes from Mark Brown: "Two device specific fixes here, one avoiding glitches on chip select with the STM32 driver and one for incorrectly configured clocks on the Microchip QSPI controller" * tag 'spi-fix-v6.9-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi: spi: microchip-core-qspi: fix setting spi bus clock rate spi: stm32: enable controller before asserting CS
2 parents 99dff48 + ef13561 commit ed44935

File tree

2 files changed

+3
-12
lines changed

2 files changed

+3
-12
lines changed

drivers/spi/spi-microchip-core-qspi.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,7 @@ static int mchp_coreqspi_setup_clock(struct mchp_coreqspi *qspi, struct spi_devi
283283
}
284284

285285
control = readl_relaxed(qspi->regs + REG_CONTROL);
286+
control &= ~CONTROL_CLKRATE_MASK;
286287
control |= baud_rate_val << CONTROL_CLKRATE_SHIFT;
287288
writel_relaxed(control, qspi->regs + REG_CONTROL);
288289
control = readl_relaxed(qspi->regs + REG_CONTROL);

drivers/spi/spi-stm32.c

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1016,10 +1016,8 @@ static irqreturn_t stm32fx_spi_irq_event(int irq, void *dev_id)
10161016
static irqreturn_t stm32fx_spi_irq_thread(int irq, void *dev_id)
10171017
{
10181018
struct spi_controller *ctrl = dev_id;
1019-
struct stm32_spi *spi = spi_controller_get_devdata(ctrl);
10201019

10211020
spi_finalize_current_transfer(ctrl);
1022-
stm32fx_spi_disable(spi);
10231021

10241022
return IRQ_HANDLED;
10251023
}
@@ -1187,6 +1185,8 @@ static int stm32_spi_prepare_msg(struct spi_controller *ctrl,
11871185
~clrb) | setb,
11881186
spi->base + spi->cfg->regs->cpol.reg);
11891187

1188+
stm32_spi_enable(spi);
1189+
11901190
spin_unlock_irqrestore(&spi->lock, flags);
11911191

11921192
return 0;
@@ -1204,7 +1204,6 @@ static void stm32fx_spi_dma_tx_cb(void *data)
12041204

12051205
if (spi->cur_comm == SPI_SIMPLEX_TX || spi->cur_comm == SPI_3WIRE_TX) {
12061206
spi_finalize_current_transfer(spi->ctrl);
1207-
stm32fx_spi_disable(spi);
12081207
}
12091208
}
12101209

@@ -1219,7 +1218,6 @@ static void stm32_spi_dma_rx_cb(void *data)
12191218
struct stm32_spi *spi = data;
12201219

12211220
spi_finalize_current_transfer(spi->ctrl);
1222-
spi->cfg->disable(spi);
12231221
}
12241222

12251223
/**
@@ -1307,8 +1305,6 @@ static int stm32fx_spi_transfer_one_irq(struct stm32_spi *spi)
13071305

13081306
stm32_spi_set_bits(spi, STM32FX_SPI_CR2, cr2);
13091307

1310-
stm32_spi_enable(spi);
1311-
13121308
/* starting data transfer when buffer is loaded */
13131309
if (spi->tx_buf)
13141310
spi->cfg->write_tx(spi);
@@ -1345,8 +1341,6 @@ static int stm32h7_spi_transfer_one_irq(struct stm32_spi *spi)
13451341

13461342
spin_lock_irqsave(&spi->lock, flags);
13471343

1348-
stm32_spi_enable(spi);
1349-
13501344
/* Be sure to have data in fifo before starting data transfer */
13511345
if (spi->tx_buf)
13521346
stm32h7_spi_write_txfifo(spi);
@@ -1378,8 +1372,6 @@ static void stm32fx_spi_transfer_one_dma_start(struct stm32_spi *spi)
13781372
*/
13791373
stm32_spi_set_bits(spi, STM32FX_SPI_CR2, STM32FX_SPI_CR2_ERRIE);
13801374
}
1381-
1382-
stm32_spi_enable(spi);
13831375
}
13841376

13851377
/**
@@ -1413,8 +1405,6 @@ static void stm32h7_spi_transfer_one_dma_start(struct stm32_spi *spi)
14131405

14141406
stm32_spi_set_bits(spi, STM32H7_SPI_IER, ier);
14151407

1416-
stm32_spi_enable(spi);
1417-
14181408
if (STM32_SPI_HOST_MODE(spi))
14191409
stm32_spi_set_bits(spi, STM32H7_SPI_CR1, STM32H7_SPI_CR1_CSTART);
14201410
}

0 commit comments

Comments
 (0)