Skip to content

Commit 56912da

Browse files
Marek Vasutbroonie
authored andcommitted
spi: cadence: Correct initialisation of runtime PM again
The original implementation of RPM handling in probe() was mostly correct, except it failed to call pm_runtime_get_*() to activate the hardware. The subsequent fix, 734882a ("spi: cadence: Correct initialisation of runtime PM"), breaks the implementation further, to the point where the system using this hard IP on ZynqMP hangs on boot, because it accesses hardware which is gated off. Undo 734882a ("spi: cadence: Correct initialisation of runtime PM") and instead add missing pm_runtime_get_noresume() and move the RPM disabling all the way to the end of probe(). That makes ZynqMP not hang on boot yet again. Fixes: 734882a ("spi: cadence: Correct initialisation of runtime PM") Signed-off-by: Marek Vasut <marex@denx.de> Cc: Charles Keepax <ckeepax@opensource.cirrus.com> Cc: Mark Brown <broonie@kernel.org> Link: https://lore.kernel.org/r/20210716182133.218640-1-marex@denx.de Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent 9cb2ff1 commit 56912da

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

drivers/spi/spi-cadence.c

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -517,6 +517,12 @@ static int cdns_spi_probe(struct platform_device *pdev)
517517
goto clk_dis_apb;
518518
}
519519

520+
pm_runtime_use_autosuspend(&pdev->dev);
521+
pm_runtime_set_autosuspend_delay(&pdev->dev, SPI_AUTOSUSPEND_TIMEOUT);
522+
pm_runtime_get_noresume(&pdev->dev);
523+
pm_runtime_set_active(&pdev->dev);
524+
pm_runtime_enable(&pdev->dev);
525+
520526
ret = of_property_read_u32(pdev->dev.of_node, "num-cs", &num_cs);
521527
if (ret < 0)
522528
master->num_chipselect = CDNS_SPI_DEFAULT_NUM_CS;
@@ -531,11 +537,6 @@ static int cdns_spi_probe(struct platform_device *pdev)
531537
/* SPI controller initializations */
532538
cdns_spi_init_hw(xspi);
533539

534-
pm_runtime_set_active(&pdev->dev);
535-
pm_runtime_enable(&pdev->dev);
536-
pm_runtime_use_autosuspend(&pdev->dev);
537-
pm_runtime_set_autosuspend_delay(&pdev->dev, SPI_AUTOSUSPEND_TIMEOUT);
538-
539540
irq = platform_get_irq(pdev, 0);
540541
if (irq <= 0) {
541542
ret = -ENXIO;
@@ -566,6 +567,9 @@ static int cdns_spi_probe(struct platform_device *pdev)
566567

567568
master->bits_per_word_mask = SPI_BPW_MASK(8);
568569

570+
pm_runtime_mark_last_busy(&pdev->dev);
571+
pm_runtime_put_autosuspend(&pdev->dev);
572+
569573
ret = spi_register_master(master);
570574
if (ret) {
571575
dev_err(&pdev->dev, "spi_register_master failed\n");

0 commit comments

Comments
 (0)