From patchwork Wed Dec 23 10:59:28 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 58972 Delivered-To: patch@linaro.org Received: by 10.112.89.199 with SMTP id bq7csp3782404lbb; Wed, 23 Dec 2015 03:01:48 -0800 (PST) X-Received: by 10.66.148.167 with SMTP id tt7mr43505159pab.62.1450868508159; Wed, 23 Dec 2015 03:01:48 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id di6si797609pad.172.2015.12.23.03.01.47; Wed, 23 Dec 2015 03:01:48 -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 S934257AbbLWLBj (ORCPT + 29 others); Wed, 23 Dec 2015 06:01:39 -0500 Received: from mailout2.w1.samsung.com ([210.118.77.12]:32208 "EHLO mailout2.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934237AbbLWLAu (ORCPT ); Wed, 23 Dec 2015 06:00:50 -0500 Received: from eucpsbgm2.samsung.com (unknown [203.254.199.245]) by mailout2.w1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0NZT009FR59AKCC0@mailout2.w1.samsung.com>; Wed, 23 Dec 2015 11:00:47 +0000 (GMT) X-AuditID: cbfec7f5-f79b16d000005389-4e-567a7ededabd Received: from eusync3.samsung.com ( [203.254.199.213]) by eucpsbgm2.samsung.com (EUCPMTA) with SMTP id AA.85.21385.EDE7A765; Wed, 23 Dec 2015 11:00:46 +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 <0NZT004GC5932LA0@eusync3.samsung.com>; Wed, 23 Dec 2015 11:00:46 +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 5/5] ARM: amba: Properly handle devices with power domains Date: Wed, 23 Dec 2015 11:59:28 +0100 Message-id: <1450868368-5650-6-git-send-email-m.szyprowski@samsung.com> X-Mailer: git-send-email 1.9.2 In-reply-to: <1450868368-5650-1-git-send-email-m.szyprowski@samsung.com> References: <1450868368-5650-1-git-send-email-m.szyprowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrLLMWRmVeSWpSXmKPExsVy+t/xq7r36qrCDHo3GVtsnLGe1WL61AuM Fs2L17NZvH5haNH/+DWzxabH11gtLu+aw2Yx4/w+Jovbl3kt1h65y27Rt/YSm8XxteEOPB4t zT1sHjvuLmH0WLznJZPHplWdbB53ru1h89g/dw27x+Yl9R59W1YxenzeJBfAGcVlk5Kak1mW WqRvl8CVsbK3kbGgh6Pi28WrjA2MR9m6GDk5JARMJCZO+AFli0lcuLceyObiEBJYyijxf+Un FginiUni+NwXLCBVbAKGEl1vu8A6RASyJebv7WYHKWIWmM8s8XBVPytIQljAV6J/+T12EJtF QFXi797jQHEODl4Bd4m7J2wgtslJ/H+5ggnE5hTwkLiz/BUziC0EVNJ28A3zBEbeBYwMqxhF U0uTC4qT0nON9IoTc4tL89L1kvNzNzFCAvXrDsalx6wOMQpwMCrx8L5orgwTYk0sK67MPcQo wcGsJMKb/g4oxJuSWFmVWpQfX1Sak1p8iFGag0VJnHfmrvchQgLpiSWp2ampBalFMFkmDk6p BsZCg7vnJgc47GNeyfTK2vc5u+VGsUsrUq59c/z8K/5IdBtH6b4PJlm+B8XNNywM3XjixVXW Essz1lVneCbtPPc/bs4bLS7ZOv99qx0Vd23MEc+wkXXucxXsu9I4VztQeb5N6+0XveKdEkdv OjHLnlA/c+8U871ErU+XX/WuquK5vvh3JLNBQLwSS3FGoqEWc1FxIgDTkGowUAIAAA== 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 -- 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/ 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;