Skip to contentSkip to conversation

spi/pxa2xx: fix runtime PM enabling order

PATCH New Antonio Ospite 2 participants 2 messages May 30, 2014 – Jun 1, 2014

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 spi/pxa2xx: fix runtime PM enabling order

In commit 7dd62787334ac6e0e2a0ef3f20bb1936ac431b04 (spi/pxa2xx: Convert to core runtime PM) master->auto_runtime_pm was set to true.

In this case pm_runtime_enable() must be called *before* spi_register_master(), otherwise the kernel hangs with this error message:

spi_master spi0: Failed to power device: -13

A similar fix, but for spi/hspi, was applied in
268d76430d1b68c340687357ffd18b4b12d02269.

---

Hi,

I must admit I copied from 268d76430d1b68c340687357ffd18b4b12d02269 without understanding much of what is going on, but fact is that the patch makes my board boot again.

Can anyone confirm that this is indeed the correct fix?

Thanks,
Antonio

 drivers/spi/spi-pxa2xx.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/spi/spi-pxa2xx.c +5 -5
index 41185d0..a07b758 100644
@@ -1202,6 +1202,11 @@ static int pxa2xx_spi_probe(struct platform_device *pdev)
 	tasklet_init(&drv_data->pump_transfers, pump_transfers,
 		     (unsigned long)drv_data);
 
+	pm_runtime_set_autosuspend_delay(&pdev->dev, 50);
+	pm_runtime_use_autosuspend(&pdev->dev);
+	pm_runtime_set_active(&pdev->dev);
+	pm_runtime_enable(&pdev->dev);
+
 	/* Register with the SPI framework */
 	platform_set_drvdata(pdev, drv_data);
 	status = devm_spi_register_master(&pdev->dev, master);
@@ -1210,11 +1215,6 @@ static int pxa2xx_spi_probe(struct platform_device *pdev)
 		goto out_error_clock_enabled;
 	}
 
-	pm_runtime_set_autosuspend_delay(&pdev->dev, 50);
-	pm_runtime_use_autosuspend(&pdev->dev);
-	pm_runtime_set_active(&pdev->dev);
-	pm_runtime_enable(&pdev->dev);
-
 	return status;
 
 out_error_clock_enabled:
Signature · 1 line
2.0.0
maintainer Applied
#1 lore raw

PATCH 1/1 spi/pxa2xx: fix runtime PM enabling order

Quoted 2 lines · Antonio Ospite

In commit 7dd62787334ac6e0e2a0ef3f20bb1936ac431b04 (spi/pxa2xx: Convert to core runtime PM) master->auto_runtime_pm was set to true.

Applied, thanks.

Quoted 5 lines

I must admit I copied from 268d76430d1b68c340687357ffd18b4b12d02269 without understanding much of what is going on, but fact is that the patch makes my board boot again.

Can anyone confirm that this is indeed the correct fix?

We need to either have the clocks and whatever enabled until runtime PM
is enabled or have runtime PM enabled before the controller and hence
clients can be registered.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20140601/b01d2b66/attachment.sig>