Skip to content

Commit 5d2f535

Browse files
committed
Merge tag 'spi-fix-v6.6-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi
Pull spi fixes from Mark Brown: "A small collection of fixes, plus a new device ID for Intel Granite Rapids systems. The fix for the i.MX driver is fairly urgent, it's fixing a data corruption issue when bits per word isn't 8. There's also one fix which was queued but not sent for v6.4 due to being minor and arriving at the end of the release" * tag 'spi-fix-v6.6-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi: spi: imx: Take in account bits per word instead of assuming 8-bits spi: intel-pci: Add support for Granite Rapids SPI serial flash spi: stm32: add a delay before SPI disable spi: nxp-fspi: reset the FLSHxCR1 registers spi: zynqmp-gqspi: fix clock imbalance on probe failure
2 parents 1c0a21d + 4221a2b commit 5d2f535

File tree

5 files changed

+25
-5
lines changed

5 files changed

+25
-5
lines changed

drivers/spi/spi-imx.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -662,7 +662,7 @@ static int mx51_ecspi_prepare_transfer(struct spi_imx_data *spi_imx,
662662
if (spi_imx->count >= 512)
663663
ctrl |= 0xFFF << MX51_ECSPI_CTRL_BL_OFFSET;
664664
else
665-
ctrl |= (spi_imx->count*8 - 1)
665+
ctrl |= (spi_imx->count * spi_imx->bits_per_word - 1)
666666
<< MX51_ECSPI_CTRL_BL_OFFSET;
667667
}
668668

drivers/spi/spi-intel-pci.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ static const struct pci_device_id intel_spi_pci_ids[] = {
7272
{ PCI_VDEVICE(INTEL, 0x4da4), (unsigned long)&bxt_info },
7373
{ PCI_VDEVICE(INTEL, 0x51a4), (unsigned long)&cnl_info },
7474
{ PCI_VDEVICE(INTEL, 0x54a4), (unsigned long)&cnl_info },
75+
{ PCI_VDEVICE(INTEL, 0x5794), (unsigned long)&cnl_info },
7576
{ PCI_VDEVICE(INTEL, 0x7a24), (unsigned long)&cnl_info },
7677
{ PCI_VDEVICE(INTEL, 0x7aa4), (unsigned long)&cnl_info },
7778
{ PCI_VDEVICE(INTEL, 0x7e23), (unsigned long)&cnl_info },

drivers/spi/spi-nxp-fspi.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1084,6 +1084,13 @@ static int nxp_fspi_default_setup(struct nxp_fspi *f)
10841084
fspi_writel(f, FSPI_AHBCR_PREF_EN | FSPI_AHBCR_RDADDROPT,
10851085
base + FSPI_AHBCR);
10861086

1087+
/* Reset the FLSHxCR1 registers. */
1088+
reg = FSPI_FLSHXCR1_TCSH(0x3) | FSPI_FLSHXCR1_TCSS(0x3);
1089+
fspi_writel(f, reg, base + FSPI_FLSHA1CR1);
1090+
fspi_writel(f, reg, base + FSPI_FLSHA2CR1);
1091+
fspi_writel(f, reg, base + FSPI_FLSHB1CR1);
1092+
fspi_writel(f, reg, base + FSPI_FLSHB2CR1);
1093+
10871094
/* AHB Read - Set lut sequence ID for all CS. */
10881095
fspi_writel(f, SEQID_LUT, base + FSPI_FLSHA1CR2);
10891096
fspi_writel(f, SEQID_LUT, base + FSPI_FLSHA2CR2);

drivers/spi/spi-stm32.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,7 @@ struct stm32_spi_cfg {
277277
* @fifo_size: size of the embedded fifo in bytes
278278
* @cur_midi: master inter-data idleness in ns
279279
* @cur_speed: speed configured in Hz
280+
* @cur_half_period: time of a half bit in us
280281
* @cur_bpw: number of bits in a single SPI data frame
281282
* @cur_fthlv: fifo threshold level (data frames in a single data packet)
282283
* @cur_comm: SPI communication mode
@@ -304,6 +305,7 @@ struct stm32_spi {
304305

305306
unsigned int cur_midi;
306307
unsigned int cur_speed;
308+
unsigned int cur_half_period;
307309
unsigned int cur_bpw;
308310
unsigned int cur_fthlv;
309311
unsigned int cur_comm;
@@ -468,6 +470,8 @@ static int stm32_spi_prepare_mbr(struct stm32_spi *spi, u32 speed_hz,
468470

469471
spi->cur_speed = spi->clk_rate / (1 << mbrdiv);
470472

473+
spi->cur_half_period = DIV_ROUND_CLOSEST(USEC_PER_SEC, 2 * spi->cur_speed);
474+
471475
return mbrdiv - 1;
472476
}
473477

@@ -709,6 +713,10 @@ static void stm32h7_spi_disable(struct stm32_spi *spi)
709713
return;
710714
}
711715

716+
/* Add a delay to make sure that transmission is ended. */
717+
if (spi->cur_half_period)
718+
udelay(spi->cur_half_period);
719+
712720
if (spi->cur_usedma && spi->dma_tx)
713721
dmaengine_terminate_async(spi->dma_tx);
714722
if (spi->cur_usedma && spi->dma_rx)

drivers/spi/spi-zynqmp-gqspi.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1340,9 +1340,9 @@ static int zynqmp_qspi_probe(struct platform_device *pdev)
13401340
return 0;
13411341

13421342
clk_dis_all:
1343-
pm_runtime_put_sync(&pdev->dev);
1344-
pm_runtime_set_suspended(&pdev->dev);
13451343
pm_runtime_disable(&pdev->dev);
1344+
pm_runtime_put_noidle(&pdev->dev);
1345+
pm_runtime_set_suspended(&pdev->dev);
13461346
clk_disable_unprepare(xqspi->refclk);
13471347
clk_dis_pclk:
13481348
clk_disable_unprepare(xqspi->pclk);
@@ -1366,11 +1366,15 @@ static void zynqmp_qspi_remove(struct platform_device *pdev)
13661366
{
13671367
struct zynqmp_qspi *xqspi = platform_get_drvdata(pdev);
13681368

1369+
pm_runtime_get_sync(&pdev->dev);
1370+
13691371
zynqmp_gqspi_write(xqspi, GQSPI_EN_OFST, 0x0);
1372+
1373+
pm_runtime_disable(&pdev->dev);
1374+
pm_runtime_put_noidle(&pdev->dev);
1375+
pm_runtime_set_suspended(&pdev->dev);
13701376
clk_disable_unprepare(xqspi->refclk);
13711377
clk_disable_unprepare(xqspi->pclk);
1372-
pm_runtime_set_suspended(&pdev->dev);
1373-
pm_runtime_disable(&pdev->dev);
13741378
}
13751379

13761380
MODULE_DEVICE_TABLE(of, zynqmp_qspi_of_match);

0 commit comments

Comments
 (0)