From patchwork Wed Feb 10 10:47:30 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 8270161 Return-Path: X-Original-To: patchwork-linux-arm@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 CD0EE9FBF9 for ; Wed, 10 Feb 2016 10:51:01 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id EC6C120251 for ; Wed, 10 Feb 2016 10:51:00 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 134F720121 for ; Wed, 10 Feb 2016 10:51:00 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1aTSL1-0004wv-P9; Wed, 10 Feb 2016 10:49:35 +0000 Received: from mailout2.w1.samsung.com ([210.118.77.12]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1aTSJr-0004Bc-3V for linux-arm-kernel@lists.infradead.org; Wed, 10 Feb 2016 10:48:25 +0000 Received: from eucpsbgm1.samsung.com (unknown [203.254.199.244]) by mailout2.w1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0O2B00JQMVBXL840@mailout2.w1.samsung.com> for linux-arm-kernel@lists.infradead.org; Wed, 10 Feb 2016 10:47:57 +0000 (GMT) X-AuditID: cbfec7f4-f79026d00000418a-6d-56bb155d3b9f Received: from eusync1.samsung.com ( [203.254.199.211]) by eucpsbgm1.samsung.com (EUCPMTA) with SMTP id 73.28.16778.D551BB65; Wed, 10 Feb 2016 10:47:57 +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 <0O2B00JPPVBNIG20@eusync1.samsung.com>; Wed, 10 Feb 2016 10:47:57 +0000 (GMT) From: Marek Szyprowski To: linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v5 RESEND 5/5] ARM: amba: Properly handle devices with power domains Date: Wed, 10 Feb 2016 11:47:30 +0100 Message-id: <1455101250-11327-6-git-send-email-m.szyprowski@samsung.com> X-Mailer: git-send-email 1.9.2 In-reply-to: <1455101250-11327-1-git-send-email-m.szyprowski@samsung.com> References: <1455101250-11327-1-git-send-email-m.szyprowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrNLMWRmVeSWpSXmKPExsVy+t/xy7qxorvDDHauULbYOGM9q8X0qRcY LZoXr2ezeP3C0KL/8Wtmi02Pr7FaXN41h81ixvl9TBa3L/NarD1yl92ib+0lNovja8MdeDxa mnvYPHbcXcLosXjPSyaPTas62TzuXNvD5rF/7hp2j81L6j36tqxi9Pi8SS6AM4rLJiU1J7Ms tUjfLoErY2VvI2NBD0fFt4tXGRsYj7J1MXJwSAiYSNxc7tvFyAlkiklcuLeeDcQWEljKKPFn jVIXIxeQ3cQk8WL+SyaQBJuAoUTX2y6wIhGBbIn5e7vZQYqYBeYzSzxc1c8KkhAWCJPY37YC rIhFQFVi1fdGsGZeAQ+JHTtbWCC2yUn8f7mCCeQITgFPiStL8yAWe0g0rDnEPIGRdwEjwypG 0dTS5ILipPRcQ73ixNzi0rx0veT83E2MkCD9soNx8TGrQ4wCHIxKPLw3THaFCbEmlhVX5h5i lOBgVhLhncS+O0yINyWxsiq1KD++qDQntfgQozQHi5I479xd70OEBNITS1KzU1MLUotgskwc nFINjBIzdxhl/T1a8+zDu7J6xmOKD4VOvDLs651w7VLtq+CUa4aTunP4ApyE/ERdHv2bOOet h0bNpqTM23UaR/n+l1harV2uqX1uZrbFjlCJ2BV+0zvqF8s9F2gzYm3zzpAz3xay/ZNAqptY b2xojmfPl1/ly6I2Bp/Y6rz97ob5d5PiorV6T/ipKbEUZyQaajEXFScCABk+XMFOAgAA X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160210_024823_539344_EDD8C9BB X-CRM114-Status: GOOD ( 15.82 ) X-Spam-Score: -7.2 (-------) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ulf Hansson , Russell King - ARM Linux , Tomeu Vizoso , Bartlomiej Zolnierkiewicz , Greg Kroah-Hartman , Krzysztof Kozlowski , Kukjin Kim , Dan Williams , Marek Szyprowski MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, 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;