Skip to content

Commit 7c30b85

Browse files
committed
Merge tag 'spi-fix-v5.8-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi
Pull spi fixes from Mark Brown: "A batch of fixes for the Freescale DSPI driver fixing some serious issues with removal of active devices and one resume case, plus a few new PCI IDs for Intel platforms" * tag 'spi-fix-v5.8-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi: spi: pxa2xx: Add support for Intel Tiger Lake PCH-H spi: spi-fsl-dspi: Initialize completion before possible interrupt spi: spi-fsl-dspi: Fix external abort on interrupt in resume or exit paths spi: spi-fsl-dspi: Fix lockup if device is shutdown during SPI transfer spi: spi-fsl-dspi: Fix lockup if device is removed during SPI transfer
2 parents be88fef + cf961fc commit 7c30b85

File tree

2 files changed

+27
-17
lines changed

2 files changed

+27
-17
lines changed

drivers/spi/spi-fsl-dspi.c

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1109,6 +1109,8 @@ static int dspi_suspend(struct device *dev)
11091109
struct spi_controller *ctlr = dev_get_drvdata(dev);
11101110
struct fsl_dspi *dspi = spi_controller_get_devdata(ctlr);
11111111

1112+
if (dspi->irq)
1113+
disable_irq(dspi->irq);
11121114
spi_controller_suspend(ctlr);
11131115
clk_disable_unprepare(dspi->clk);
11141116

@@ -1129,6 +1131,8 @@ static int dspi_resume(struct device *dev)
11291131
if (ret)
11301132
return ret;
11311133
spi_controller_resume(ctlr);
1134+
if (dspi->irq)
1135+
enable_irq(dspi->irq);
11321136

11331137
return 0;
11341138
}
@@ -1385,22 +1389,22 @@ static int dspi_probe(struct platform_device *pdev)
13851389
goto poll_mode;
13861390
}
13871391

1388-
ret = devm_request_irq(&pdev->dev, dspi->irq, dspi_interrupt,
1389-
IRQF_SHARED, pdev->name, dspi);
1392+
init_completion(&dspi->xfer_done);
1393+
1394+
ret = request_threaded_irq(dspi->irq, dspi_interrupt, NULL,
1395+
IRQF_SHARED, pdev->name, dspi);
13901396
if (ret < 0) {
13911397
dev_err(&pdev->dev, "Unable to attach DSPI interrupt\n");
13921398
goto out_clk_put;
13931399
}
13941400

1395-
init_completion(&dspi->xfer_done);
1396-
13971401
poll_mode:
13981402

13991403
if (dspi->devtype_data->trans_mode == DSPI_DMA_MODE) {
14001404
ret = dspi_request_dma(dspi, res->start);
14011405
if (ret < 0) {
14021406
dev_err(&pdev->dev, "can't get dma channels\n");
1403-
goto out_clk_put;
1407+
goto out_free_irq;
14041408
}
14051409
}
14061410

@@ -1415,11 +1419,14 @@ static int dspi_probe(struct platform_device *pdev)
14151419
ret = spi_register_controller(ctlr);
14161420
if (ret != 0) {
14171421
dev_err(&pdev->dev, "Problem registering DSPI ctlr\n");
1418-
goto out_clk_put;
1422+
goto out_free_irq;
14191423
}
14201424

14211425
return ret;
14221426

1427+
out_free_irq:
1428+
if (dspi->irq)
1429+
free_irq(dspi->irq, dspi);
14231430
out_clk_put:
14241431
clk_disable_unprepare(dspi->clk);
14251432
out_ctlr_put:
@@ -1434,18 +1441,8 @@ static int dspi_remove(struct platform_device *pdev)
14341441
struct fsl_dspi *dspi = spi_controller_get_devdata(ctlr);
14351442

14361443
/* Disconnect from the SPI framework */
1437-
dspi_release_dma(dspi);
1438-
clk_disable_unprepare(dspi->clk);
14391444
spi_unregister_controller(dspi->ctlr);
14401445

1441-
return 0;
1442-
}
1443-
1444-
static void dspi_shutdown(struct platform_device *pdev)
1445-
{
1446-
struct spi_controller *ctlr = platform_get_drvdata(pdev);
1447-
struct fsl_dspi *dspi = spi_controller_get_devdata(ctlr);
1448-
14491446
/* Disable RX and TX */
14501447
regmap_update_bits(dspi->regmap, SPI_MCR,
14511448
SPI_MCR_DIS_TXF | SPI_MCR_DIS_RXF,
@@ -1455,8 +1452,16 @@ static void dspi_shutdown(struct platform_device *pdev)
14551452
regmap_update_bits(dspi->regmap, SPI_MCR, SPI_MCR_HALT, SPI_MCR_HALT);
14561453

14571454
dspi_release_dma(dspi);
1455+
if (dspi->irq)
1456+
free_irq(dspi->irq, dspi);
14581457
clk_disable_unprepare(dspi->clk);
1459-
spi_unregister_controller(dspi->ctlr);
1458+
1459+
return 0;
1460+
}
1461+
1462+
static void dspi_shutdown(struct platform_device *pdev)
1463+
{
1464+
dspi_remove(pdev);
14601465
}
14611466

14621467
static struct platform_driver fsl_dspi_driver = {

drivers/spi/spi-pxa2xx.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1485,6 +1485,11 @@ static const struct pci_device_id pxa2xx_spi_pci_compound_match[] = {
14851485
{ PCI_VDEVICE(INTEL, 0x4daa), LPSS_CNL_SSP },
14861486
{ PCI_VDEVICE(INTEL, 0x4dab), LPSS_CNL_SSP },
14871487
{ PCI_VDEVICE(INTEL, 0x4dfb), LPSS_CNL_SSP },
1488+
/* TGL-H */
1489+
{ PCI_VDEVICE(INTEL, 0x43aa), LPSS_CNL_SSP },
1490+
{ PCI_VDEVICE(INTEL, 0x43ab), LPSS_CNL_SSP },
1491+
{ PCI_VDEVICE(INTEL, 0x43fb), LPSS_CNL_SSP },
1492+
{ PCI_VDEVICE(INTEL, 0x43fd), LPSS_CNL_SSP },
14881493
/* APL */
14891494
{ PCI_VDEVICE(INTEL, 0x5ac2), LPSS_BXT_SSP },
14901495
{ PCI_VDEVICE(INTEL, 0x5ac4), LPSS_BXT_SSP },

0 commit comments

Comments
 (0)