From patchwork Fri May 30 16:18:09 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Antonio Ospite X-Patchwork-Id: 4272211 Return-Path: X-Original-To: patchwork-linux-spi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 5E1CBBEEA7 for ; Fri, 30 May 2014 16:19:00 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9A40420384 for ; Fri, 30 May 2014 16:18:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0BFFA2038F for ; Fri, 30 May 2014 16:18:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933247AbaE3QS5 (ORCPT ); Fri, 30 May 2014 12:18:57 -0400 Received: from smtp205.alice.it ([82.57.200.101]:15942 "EHLO smtp205.alice.it" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932378AbaE3QS5 (ORCPT ); Fri, 30 May 2014 12:18:57 -0400 Received: from jcn (87.3.13.245) by smtp205.alice.it (8.6.060.28) id 529A593126A0EAA4; Fri, 30 May 2014 18:18:24 +0200 Received: from ao2 by jcn with local (Exim 4.82_1-5b7a7c0-XX) (envelope-from ) id 1WqPVe-0006L7-Ph; Fri, 30 May 2014 18:18:22 +0200 From: Antonio Ospite To: linux-arm-kernel@lists.infradead.org, linux-spi@vger.kernel.org Cc: Antonio Ospite , Eric Miao , Russell King , Haojian Zhuang , Mark Brown Subject: [PATCH] spi/pxa2xx: fix runtime PM enabling order Date: Fri, 30 May 2014 18:18:09 +0200 Message-Id: <1401466689-24335-1-git-send-email-ao2@ao2.it> X-Mailer: git-send-email 2.0.0 X-Face: z*RaLf`X<@C75u6Ig9}{oW$H; 1_\2t5)({*|jhM/Vb; ]yA5\I~93>J<_`<4)A{':UrE Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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(-) diff --git a/drivers/spi/spi-pxa2xx.c b/drivers/spi/spi-pxa2xx.c index 41185d0..a07b758 100644 --- a/drivers/spi/spi-pxa2xx.c +++ b/drivers/spi/spi-pxa2xx.c @@ -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: