From: Antonio Ospite <a...@ao2.it>

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.

Signed-off-by: Antonio Ospite <a...@ao2.it>
Signed-off-by: Mark Brown <broo...@linaro.org>
(cherry picked from commit 836d1a22db9ee0a466301465e873bc94da86cb15)
Signed-off-by: Chang Rebecca Swee Fun <rebecca.swee.fun.ch...@intel.com>
---
 drivers/spi/spi-pxa2xx.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/spi/spi-pxa2xx.c b/drivers/spi/spi-pxa2xx.c
index 3971e23..9e67394 100644
--- a/drivers/spi/spi-pxa2xx.c
+++ b/drivers/spi/spi-pxa2xx.c
@@ -1214,6 +1214,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 = spi_register_master(master);
@@ -1222,11 +1227,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:
-- 
1.9.1

-- 
_______________________________________________
linux-yocto mailing list
linux-yocto@yoctoproject.org
https://lists.yoctoproject.org/listinfo/linux-yocto

Reply via email to