Skip to content

Commit 3c525b6

Browse files
krzkbroonie
authored andcommitted
spi: spi-fsl-dspi: Fix lockup if device is shutdown during SPI transfer
During shutdown, the driver should unregister the SPI controller and stop the hardware. Otherwise the dspi_transfer_one_message() could wait on completion infinitely. Additionally, calling spi_unregister_controller() first in device shutdown reverse-matches the probe function, where SPI controller is registered at the end. Fixes: dc23482 ("spi: spi-fsl-dspi: Adding shutdown hook") Reported-by: Vladimir Oltean <[email protected]> Signed-off-by: Krzysztof Kozlowski <[email protected]> Tested-by: Vladimir Oltean <[email protected]> Reviewed-by: Vladimir Oltean <[email protected]> Cc: <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent 7684580 commit 3c525b6

File tree

1 file changed

+1
-14
lines changed

1 file changed

+1
-14
lines changed

drivers/spi/spi-fsl-dspi.c

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1452,20 +1452,7 @@ static int dspi_remove(struct platform_device *pdev)
14521452

14531453
static void dspi_shutdown(struct platform_device *pdev)
14541454
{
1455-
struct spi_controller *ctlr = platform_get_drvdata(pdev);
1456-
struct fsl_dspi *dspi = spi_controller_get_devdata(ctlr);
1457-
1458-
/* Disable RX and TX */
1459-
regmap_update_bits(dspi->regmap, SPI_MCR,
1460-
SPI_MCR_DIS_TXF | SPI_MCR_DIS_RXF,
1461-
SPI_MCR_DIS_TXF | SPI_MCR_DIS_RXF);
1462-
1463-
/* Stop Running */
1464-
regmap_update_bits(dspi->regmap, SPI_MCR, SPI_MCR_HALT, SPI_MCR_HALT);
1465-
1466-
dspi_release_dma(dspi);
1467-
clk_disable_unprepare(dspi->clk);
1468-
spi_unregister_controller(dspi->ctlr);
1455+
dspi_remove(pdev);
14691456
}
14701457

14711458
static struct platform_driver fsl_dspi_driver = {

0 commit comments

Comments
 (0)