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: 61636 Delivered-To: patch@linaro.org Received: by 10.112.43.199 with SMTP id y7csp2564406lbl; Wed, 10 Feb 2016 02:48:45 -0800 (PST) X-Received: by 10.98.72.24 with SMTP id v24mr56816362pfa.15.1455101325074; Wed, 10 Feb 2016 02:48:45 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o9si4363678pfa.130.2016.02.10.02.48.44; Wed, 10 Feb 2016 02:48:45 -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 S1753815AbcBJKsm (ORCPT + 30 others); Wed, 10 Feb 2016 05:48:42 -0500 Received: from mailout2.w1.samsung.com ([210.118.77.12]:24367 "EHLO mailout2.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753116AbcBJKsC (ORCPT ); Wed, 10 Feb 2016 05:48:02 -0500 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>; 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 Cc: Marek Szyprowski , Russell King - ARM Linux , Ulf Hansson , Tomeu Vizoso , Greg Kroah-Hartman , Dan Williams , Kukjin Kim , Krzysztof Kozlowski , Bartlomiej Zolnierkiewicz 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 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 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;