From patchwork Wed Dec 2 07:21:43 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 7743241 Return-Path: X-Original-To: patchwork-linux-samsung-soc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 6D2AB9F1C2 for ; Wed, 2 Dec 2015 07:22:35 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9AE4C206B5 for ; Wed, 2 Dec 2015 07:22:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 565D620674 for ; Wed, 2 Dec 2015 07:22:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756802AbbLBHWO (ORCPT ); Wed, 2 Dec 2015 02:22:14 -0500 Received: from mailout3.w1.samsung.com ([210.118.77.13]:10628 "EHLO mailout3.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754535AbbLBHV5 (ORCPT ); Wed, 2 Dec 2015 02:21:57 -0500 Received: from eucpsbgm2.samsung.com (unknown [203.254.199.245]) by mailout3.w1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0NYP001LSZ4HAN90@mailout3.w1.samsung.com>; Wed, 02 Dec 2015 07:21:53 +0000 (GMT) X-AuditID: cbfec7f5-f79b16d000005389-91-565e9c10526e Received: from eusync1.samsung.com ( [203.254.199.211]) by eucpsbgm2.samsung.com (EUCPMTA) with SMTP id 4B.47.21385.01C9E565; Wed, 2 Dec 2015 07:21:52 +0000 (GMT) Received: from amdc1339.digital.local ([106.116.147.30]) by eusync1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0NYP00M15Z4C9D00@eusync1.samsung.com>; Wed, 02 Dec 2015 07:21:52 +0000 (GMT) From: Marek Szyprowski To: linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Marek Szyprowski , Russell King - ARM Linux , Ulf Hansson , Tomeu Vizoso , Greg Kroah-Hartman , Kukjin Kim , Krzysztof Kozlowski , Bartlomiej Zolnierkiewicz Subject: [PATCH v4 3/3] ARM: amba: Properly handle devices with power domains Date: Wed, 02 Dec 2015 08:21:43 +0100 Message-id: <1449040903-26674-4-git-send-email-m.szyprowski@samsung.com> X-Mailer: git-send-email 1.9.2 In-reply-to: <1449040903-26674-1-git-send-email-m.szyprowski@samsung.com> References: <1449040903-26674-1-git-send-email-m.szyprowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrELMWRmVeSWpSXmKPExsVy+t/xy7oCc+LCDLYutbHYOGM9q0Xz4vVs Fq9fGFr0P37NbLHp8TVWi8u75rBZzDi/j8ni9mVei7VH7rJb9K29xGZxfG24A7dHS3MPm8eO u0sYPTat6mTzuHNtD5vH/rlr2D02L6n36NuyitHj8ya5AI4oLpuU1JzMstQifbsEroyVvY2M BT0cFd8uXmVsYDzK1sXIySEhYCLRseYAM4QtJnHh3nqgOBeHkMBSRomdN04xQzhNTBKtSy8x glSxCRhKdL3tAusWEciWmL+3mx3EZhb4wiTRtMUNxBYW8JWYvXwm2FQWAVWJk1tmA/VycPAK eEgcb/KGWCYn8f/lCiYQm1PAU+L4ifNgthBQye/lJ9gnMPIuYGRYxSiaWppcUJyUnmukV5yY W1yal66XnJ+7iRESkl93MC49ZnWIUYCDUYmHdwVPXJgQa2JZcWXuIUYJDmYlEV4vGaAQb0pi ZVVqUX58UWlOavEhRmkOFiVx3pm73ocICaQnlqRmp6YWpBbBZJk4OKUaGC9texqU7KZw+7/d JZFvnwTP6benuX8RzNy1NvNK2ASf1boyznLtEXxVKuUvrvPPu3Kq7cCmr7Kx97YxvZBeps7m tIxhptWS6vdLzG4sXfN8Ttu1s51/smN//pPnMPBNfVUbxzDJ5XXRfZPHCnzGjwMnKOX+0WGS f7jd5fLbyrbFXL8XNr3dLaDEUpyRaKjFXFScCACrPgSCRQIAAA== Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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 To read pid/cid registers, the probed device need to be properly turned on. When it is inside a power domain, the bus code should ensure that the given power domain is enabled before trying to access device's registers. Signed-off-by: Marek Szyprowski Reviewed-by: Ulf Hansson --- drivers/amba/bus.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/amba/bus.c b/drivers/amba/bus.c index 643127f..570033b 100644 --- a/drivers/amba/bus.c +++ b/drivers/amba/bus.c @@ -60,6 +60,10 @@ static int amba_read_periphid(struct amba_device *dev) if (!tmp) return -ENOMEM; + ret = dev_pm_domain_attach(&dev->dev, true); + if (ret == -EPROBE_DEFER) + goto err_unmap; + ret = amba_get_enable_pclk(dev); if (ret == 0) { u32 pid, cid; @@ -84,6 +88,8 @@ static int amba_read_periphid(struct amba_device *dev) ret = -ENODEV; } + dev_pm_domain_detach(&dev->dev, true); +err_unmap: iounmap(tmp); return ret;