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: 57533 Delivered-To: patch@linaro.org Received: by 10.112.155.196 with SMTP id vy4csp2694102lbb; Tue, 1 Dec 2015 23:22:21 -0800 (PST) X-Received: by 10.98.87.83 with SMTP id l80mr2479445pfb.126.1449040941091; Tue, 01 Dec 2015 23:22:21 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 14si2792389pfq.224.2015.12.01.23.22.20; Tue, 01 Dec 2015 23:22:21 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757380AbbLBHWP (ORCPT + 28 others); Wed, 2 Dec 2015 02:22:15 -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-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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(+) -- 1.9.2 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/ 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;