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: 57329 Delivered-To: patch@linaro.org Received: by 10.112.155.196 with SMTP id vy4csp497289lbb; Thu, 26 Nov 2015 04:51:00 -0800 (PST) X-Received: by 10.98.74.26 with SMTP id x26mr38880408pfa.15.1448542259987; Thu, 26 Nov 2015 04:50:59 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r20si527624pfa.51.2015.11.26.04.50.59; Thu, 26 Nov 2015 04:50:59 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-samsung-soc-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-samsung-soc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-samsung-soc-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752203AbbKZMu4 (ORCPT + 4 others); 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 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(+) -- 1.9.2 -- To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html 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;