From patchwork Tue Sep 16 08:51:32 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 4915501 Return-Path: X-Original-To: patchwork-dmaengine@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id E54D6BEEA5 for ; Tue, 16 Sep 2014 08:53:50 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C7719201DE for ; Tue, 16 Sep 2014 08:53:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A0B3A20220 for ; Tue, 16 Sep 2014 08:53:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752688AbaIPIwQ (ORCPT ); Tue, 16 Sep 2014 04:52:16 -0400 Received: from mailout2.w1.samsung.com ([210.118.77.12]:46615 "EHLO mailout2.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752628AbaIPIwN (ORCPT ); Tue, 16 Sep 2014 04:52:13 -0400 Received: from eucpsbgm2.samsung.com (unknown [203.254.199.245]) by mailout2.w1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0NBZ001LJKROUB60@mailout2.w1.samsung.com>; Tue, 16 Sep 2014 09:55:01 +0100 (BST) X-AuditID: cbfec7f5-b7f776d000003e54-98-5417fa392a25 Received: from eusync1.samsung.com ( [203.254.199.211]) by eucpsbgm2.samsung.com (EUCPMTA) with SMTP id B0.0A.15956.93AF7145; Tue, 16 Sep 2014 09:52:09 +0100 (BST) Received: from AMDC1943.digital.local ([106.116.151.171]) by eusync1.samsung.com (Oracle Communications Messaging Server 7u4-23.01(7.0.4.23.0) 64bit (built Aug 10 2011)) with ESMTPA id <0NBZ00F59KMR6960@eusync1.samsung.com>; Tue, 16 Sep 2014 09:52:09 +0100 (BST) From: Krzysztof Kozlowski To: Russell King , Dan Williams , Vinod Koul , linux-kernel@vger.kernel.org, dmaengine@vger.kernel.org, Ulf Hansson , Grant Likely , Lars-Peter Clausen , Michal Simek , "Rafael J. Wysocki" , Len Brown , Pavel Machek , Randy Dunlap , Alan Stern , linux-doc@vger.kernel.org, linux-pm@vger.kernel.org Cc: Kyungmin Park , Marek Szyprowski , Bartlomiej Zolnierkiewicz , Krzysztof Kozlowski Subject: [PATCH v4 2/4] amba: Add helper macros for (un)preparing AMBA clock Date: Tue, 16 Sep 2014 10:51:32 +0200 Message-id: <1410857494-15936-3-git-send-email-k.kozlowski@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1410857494-15936-1-git-send-email-k.kozlowski@samsung.com> References: <1410857494-15936-1-git-send-email-k.kozlowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrILMWRmVeSWpSXmKPExsVy+t/xy7qWv8RDDFZcMrLYOGM9q8X0qRcY LVZP/ctqceDPDkaL1y8MLc42vWG3WDJ5PqvFrCl7mSwWti1hsbi8aw6bxefeI4wWty/zWqw9 cpfd4t3LCIu7p46yWby9M53F4szpS6wWE35fYLM4vjbc4mXffhYHEY+W5h42j80rtDwW73nJ 5HHn2h42jyVvDrF6bLnazuIx++4PRo++LasYPVas/s7u8XmTnMfez79ZArijuGxSUnMyy1KL 9O0SuDL2Hj7IUnCAveLSw5dMDYxr2LoYOTkkBEwknh++zgxhi0lcuLceLC4ksJRR4uJX2y5G LiC7j0li2vuDrCAJNgFjic3Ll7CBJEQEjrBIPLv3BMxhFjjKKDG99y0TSJWwgI/E8+kzwUax CKhKXGh8A7aCV8BdYu20jVDr5CROHpsMNpVTwENi0tzr7BCr3SUO7L3DPoGRdwEjwypG0dTS 5ILipPRcI73ixNzi0rx0veT83E2MkGj4uoNx6TGrQ4wCHIxKPLwzNoqFCLEmlhVX5h5ilOBg VhLhffBJPESINyWxsiq1KD++qDQntfgQIxMHp1QDY83SiSdiStySXz5btISjXbj4riwXJ5vR XF+m3r4DX09XRS1NU1gdtWNW/AS9/0dvaTkfaAnRW3PdLuJ4cuPN3S4enzVyTfyNvr5W31dU OsHr9pJgRxnnCcr7bbxnTkua9SD9YNfhM7UlKnLF0efO82t93DP/SET2JjbeyxdvZL/8PvvX 5qeZi5VYijMSDbWYi4oTAXwy+e1kAgAA Sender: dmaengine-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, 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 Add amba_pclk_prepare() and amba_pclk_unprepare() macros for handling the AMBA bus clock by device drivers. Signed-off-by: Krzysztof Kozlowski --- include/linux/amba/bus.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/include/linux/amba/bus.h b/include/linux/amba/bus.h index fdd7e1b61f60..ad52027a9cbf 100644 --- a/include/linux/amba/bus.h +++ b/include/linux/amba/bus.h @@ -92,6 +92,12 @@ void amba_release_regions(struct amba_device *); #define amba_pclk_disable(d) \ do { if (!IS_ERR((d)->pclk)) clk_disable((d)->pclk); } while (0) +#define amba_pclk_prepare(d) \ + (IS_ERR((d)->pclk) ? 0 : clk_prepare((d)->pclk)) + +#define amba_pclk_unprepare(d) \ + do { if (!IS_ERR((d)->pclk)) clk_unprepare((d)->pclk); } while (0) + /* Some drivers don't use the struct amba_device */ #define AMBA_CONFIG_BITS(a) (((a) >> 24) & 0xff) #define AMBA_REV_BITS(a) (((a) >> 20) & 0x0f)