From patchwork Tue Dec 1 13:34:26 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 57489 Delivered-To: patch@linaro.org Received: by 10.112.155.196 with SMTP id vy4csp2174563lbb; Tue, 1 Dec 2015 05:35:42 -0800 (PST) X-Received: by 10.66.65.234 with SMTP id a10mr54289821pat.129.1448976942749; Tue, 01 Dec 2015 05:35:42 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 28si9849271pfj.63.2015.12.01.05.35.12; Tue, 01 Dec 2015 05:35:42 -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 S1756340AbbLANfK (ORCPT + 28 others); Tue, 1 Dec 2015 08:35:10 -0500 Received: from mailout4.w1.samsung.com ([210.118.77.14]:44151 "EHLO mailout4.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755848AbbLANek (ORCPT ); Tue, 1 Dec 2015 08:34:40 -0500 Received: from eucpsbgm1.samsung.com (unknown [203.254.199.244]) by mailout4.w1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0NYO004WSLPQ4XA0@mailout4.w1.samsung.com>; Tue, 01 Dec 2015 13:34:38 +0000 (GMT) X-AuditID: cbfec7f4-f79026d00000418a-85-565da1eeca43 Received: from eusync1.samsung.com ( [203.254.199.211]) by eucpsbgm1.samsung.com (EUCPMTA) with SMTP id 78.E5.16778.EE1AD565; Tue, 1 Dec 2015 13:34:38 +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 <0NYO0055ZLPJVHC0@eusync1.samsung.com>; Tue, 01 Dec 2015 13:34:37 +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 v3 3/3] ARM: amba: Properly handle devices with power domains Date: Tue, 01 Dec 2015 14:34:26 +0100 Message-id: <1448976866-7892-4-git-send-email-m.szyprowski@samsung.com> X-Mailer: git-send-email 1.9.2 In-reply-to: <1448976866-7892-1-git-send-email-m.szyprowski@samsung.com> References: <1448976866-7892-1-git-send-email-m.szyprowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrMLMWRmVeSWpSXmKPExsVy+t/xy7rvFsaGGXS2s1tsnLGe1aJ58Xo2 i9cvDC36H79mttj0+BqrxeVdc9gsZpzfx2Rx+zKvxdojd9kt+tZeYrM4vjbcgdujpbmHzWPH 3SWMHptWdbJ53Lm2h81j/9w17B6bl9R79G1ZxejxeZNcAEcUl01Kak5mWWqRvl0CV8bxpZ/Y Cu6yV5zaNJetgXE2WxcjJ4eEgInE3js9rBC2mMSFe+uB4lwcQgJLGSWu3mhhhXCamCT+rZvB BFLFJmAo0fW2C6xbRCBbYv7ebnYQm1ngC5NE0xY3EFtYwFfiyISdYPUsAqoSe3+tZQaxeQXc JWYdXQC1TU7i/8sVYDWcAh4S03acA5sjBFSzds1M1gmMvAsYGVYxiqaWJhcUJ6XnGuoVJ+YW l+al6yXn525ihATllx2Mi49ZHWIU4GBU4uE9MSk2TIg1say4MvcQowQHs5IIr3Q1UIg3JbGy KrUoP76oNCe1+BCjNAeLkjjv3F3vQ4QE0hNLUrNTUwtSi2CyTBycUg2M8tW+cxmyz2eYXQ6M TDl2qHbDfZv7etKlj6/WHSt7X9+782SYq/PLybNz8pLswgPauH/ylxyeFOt0wG1KsOZKvf7V Rzxn/mvTPWOkvYJ/3rL134RFJ3yXfls9/z2D/fmKLxInY9czG4rdnhTZLmjSHvasu+VE3N5v awSPROjJz7Eqc/n1VuCREktxRqKhFnNRcSIA41oIpEYCAAA= 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 --- 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/ Reviewed-by: Ulf Hansson diff --git a/drivers/amba/bus.c b/drivers/amba/bus.c index 879a421..8d182a4 100644 --- a/drivers/amba/bus.c +++ b/drivers/amba/bus.c @@ -365,6 +365,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; @@ -389,6 +393,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;