From patchwork Thu Nov 26 12:49:50 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 7706581 Return-Path: X-Original-To: patchwork-linux-samsung-soc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id EC244BF90C for ; Thu, 26 Nov 2015 12:51:02 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2848520619 for ; Thu, 26 Nov 2015 12:51:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5104920635 for ; Thu, 26 Nov 2015 12:51:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752203AbbKZMu4 (ORCPT ); Thu, 26 Nov 2015 07:50:56 -0500 Received: from mailout3.w1.samsung.com ([210.118.77.13]:54133 "EHLO mailout3.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751014AbbKZMuF (ORCPT ); Thu, 26 Nov 2015 07:50:05 -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 <0NYF00IYJABETCA0@mailout3.w1.samsung.com>; Thu, 26 Nov 2015 12:50:02 +0000 (GMT) X-AuditID: cbfec7f5-f79b16d000005389-18-5656fffae55c Received: from eusync3.samsung.com ( [203.254.199.213]) by eucpsbgm2.samsung.com (EUCPMTA) with SMTP id 65.F8.21385.AFFF6565; Thu, 26 Nov 2015 12:50:02 +0000 (GMT) Received: from amdc1339.digital.local ([106.116.147.30]) by eusync3.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0NYF00CQ1AB8M710@eusync3.samsung.com>; Thu, 26 Nov 2015 12:50:02 +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 v2 4/4] ARM: amba: Properly handle devices with power domains Date: Thu, 26 Nov 2015 13:49:50 +0100 Message-id: <1448542190-19498-5-git-send-email-m.szyprowski@samsung.com> X-Mailer: git-send-email 1.9.2 In-reply-to: <1448542190-19498-1-git-send-email-m.szyprowski@samsung.com> References: <1448542190-19498-1-git-send-email-m.szyprowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrILMWRmVeSWpSXmKPExsVy+t/xq7q//oeFGfS+lrPYOGM9q0Xz4vVs Fq9fGFr0P37NbLHp8TVWi8u75rBZzDi/j8ni9mVei7VH7rJb9K29xGZxfG24A7dHS3MPm8eO u0sYPTat6mTzuHNtD5vH/rlr2D02L6n36NuyitHj8ya5AI4oLpuU1JzMstQifbsEroxnOw6z Ffxkr2j/coe5gXEjWxcjB4eEgInEkzPKXYycQKaYxIV764HCXBxCAksZJdb/+MQE4TQxSSzZ u4oNpIpNwFCi620XmC0ikC0xf283O4jNLPCFSaJpixvIUGEBX4nmZdwgYRYBVYmnzw8zgti8 Ah4S325PYoFYJifx/+UKJhCbU8BTYtr/DWA1QkA1k3ous05g5F3AyLCKUTS1NLmgOCk910iv ODG3uDQvXS85P3cTIyQgv+5gXHrM6hCjAAejEg9vgW1YmBBrYllxZe4hRgkOZiUR3i8PgUK8 KYmVValF+fFFpTmpxYcYpTlYlMR5Z+56HyIkkJ5YkpqdmlqQWgSTZeLglGpg9C7v3v7324uU 7BmHTzOcPG337O46BbFK1+lnVx4LjszaoxGRYSI3Vz1P7dJ67ydMiU69WtrvD5rae7TanVp3 5sh6w4c/GLV3SGw5JaF17ONvhU3u292UZu9f8OD7vxuaVntZYoPPb0s9vdh7k4Dy9I8b+BU9 6z98YfIT7er1VBCy+6ljcrh8txJLcUaioRZzUXEiAK7FNrREAgAA 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=-7.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, 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 --- drivers/amba/bus.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/amba/bus.c b/drivers/amba/bus.c index 72ebf9b..4fc1976 100644 --- a/drivers/amba/bus.c +++ b/drivers/amba/bus.c @@ -364,6 +364,10 @@ static int read_periphid(struct amba_device *d, unsigned int *periphid) if (!tmp) return -ENOMEM; + ret = dev_pm_domain_attach(&d->dev, true); + if (ret == -EPROBE_DEFER) + goto err_unmap; + ret = amba_get_enable_pclk(d); if (ret == 0) { u32 pid, cid; @@ -388,6 +392,8 @@ static int read_periphid(struct amba_device *d, unsigned int *periphid) ret = -ENODEV; } + dev_pm_domain_detach(&d->dev, true); +err_unmap: iounmap(tmp); return ret;