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: 7737301 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 A5EDDBEEE1 for ; Tue, 1 Dec 2015 13:35:35 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E218320692 for ; Tue, 1 Dec 2015 13:35:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0E3EC203C0 for ; Tue, 1 Dec 2015 13:35:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755237AbbLANfI (ORCPT ); Tue, 1 Dec 2015 08:35:08 -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-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_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 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;