From patchwork Mon Nov 24 15:18:31 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 5367981 Return-Path: X-Original-To: patchwork-linux-samsung-soc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 900CC9F39D for ; Mon, 24 Nov 2014 15:19:30 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id BC6EB20411 for ; Mon, 24 Nov 2014 15:19:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C789320425 for ; Mon, 24 Nov 2014 15:19:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754090AbaKXPTD (ORCPT ); Mon, 24 Nov 2014 10:19:03 -0500 Received: from mailout4.w1.samsung.com ([210.118.77.14]:21083 "EHLO mailout4.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753772AbaKXPSr (ORCPT ); Mon, 24 Nov 2014 10:18:47 -0500 Received: from eucpsbgm2.samsung.com (unknown [203.254.199.245]) by mailout4.w1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0NFJ00GI8UNT3JA0@mailout4.w1.samsung.com>; Mon, 24 Nov 2014 15:21:29 +0000 (GMT) X-AuditID: cbfec7f5-b7fc86d0000066b7-14-54734c548591 Received: from eusync4.samsung.com ( [203.254.199.214]) by eucpsbgm2.samsung.com (EUCPMTA) with SMTP id 8B.5F.26295.45C43745; Mon, 24 Nov 2014 15:18:44 +0000 (GMT) Received: from AMDC1943.digital.local ([106.116.151.171]) by eusync4.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0NFJ00GK5UJ2DY50@eusync4.samsung.com>; Mon, 24 Nov 2014 15:18:44 +0000 (GMT) From: Krzysztof Kozlowski To: Mike Turquette , Sylwester Nawrocki , Tomasz Figa , Kukjin Kim , linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Javier Martinez Canillas , Vivek Gautam , Kevin Hilman Cc: Krzysztof Kozlowski Subject: [RFC 1/2] clk: Allow overriding generic ops for clocks Date: Mon, 24 Nov 2014 16:18:31 +0100 Message-id: <1416842312-4405-2-git-send-email-k.kozlowski@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1416842312-4405-1-git-send-email-k.kozlowski@samsung.com> References: <1416842312-4405-1-git-send-email-k.kozlowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprALMWRmVeSWpSXmKPExsVy+t/xa7ohPsUhBns3KFu0XTnIbnH0d4HF 6xeGFv2PXzNbPN38mMli0+NrrBaXd81hs5hxfh+TxdMJF9ksDr9pZ7VYtesPowO3x9/n11k8 ds66y+6xaVUnm8eda3vYPDYvqffo27KK0ePzJrkA9igum5TUnMyy1CJ9uwSujMYt/1gK3olV HDj7nrWB8YdQFyMnh4SAicSFOxcYIWwxiQv31rN1MXJxCAksZZTY/m0RE4TTxyTx930DG0gV m4CxxOblS8CqRASmMUv8WXGcHSTBLGAo8fPdHyCbg0NYwF7iwiNhkDCLgKrE0cN3wEp4Bdwk Fv64CLVNTuLkscmsIDangLvEycen2UBahYBqbjzjmMDIu4CRYRWjaGppckFxUnqukV5xYm5x aV66XnJ+7iZGSCh+3cG49JjVIUYBDkYlHt4KzeIQIdbEsuLK3EOMEhzMSiK83V5AId6UxMqq 1KL8+KLSnNTiQ4xMHJxSDYxTBS8nJ8/u4t2wb/IuNY1fy2ueurE/up9w4JpPxjsb9YgLwV1P 8qLv/Lu9NFNWYmFzuOxVd8Mg74cr6+7JzFvcvzeesWZ7wTOm05MXxRy9deF1KcfkxSah16vq pY5E7l33don90pNPsu8LWGkIWbHN3fzzOO+5xu3rni8IO+s1o+BfAUPh5utnlViKMxINtZiL ihMB8g0x5iMCAAA= 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 For clocks depending on some other clock domain one may want to perform specific ops before actual enable/disable of gate clock. Allow such case by accepting supplied ops in new exported function: clk_register_gate_ops(). Signed-off-by: Krzysztof Kozlowski --- drivers/clk/clk-gate.c | 16 +++++++++++++--- include/linux/clk-provider.h | 5 +++++ 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/drivers/clk/clk-gate.c b/drivers/clk/clk-gate.c index 51fd87fb7ba6..51802af2d9e7 100644 --- a/drivers/clk/clk-gate.c +++ b/drivers/clk/clk-gate.c @@ -117,11 +117,12 @@ EXPORT_SYMBOL_GPL(clk_gate_ops); * @bit_idx: which bit in the register controls gating of this clock * @clk_gate_flags: gate-specific flags for this clock * @lock: shared register lock for this clock + * @ops: clk_ops to use for this clock */ -struct clk *clk_register_gate(struct device *dev, const char *name, +struct clk *clk_register_gate_ops(struct device *dev, const char *name, const char *parent_name, unsigned long flags, void __iomem *reg, u8 bit_idx, - u8 clk_gate_flags, spinlock_t *lock) + u8 clk_gate_flags, spinlock_t *lock, const struct clk_ops *ops) { struct clk_gate *gate; struct clk *clk; @@ -142,7 +143,7 @@ struct clk *clk_register_gate(struct device *dev, const char *name, } init.name = name; - init.ops = &clk_gate_ops; + init.ops = ops; init.flags = flags | CLK_IS_BASIC; init.parent_names = (parent_name ? &parent_name: NULL); init.num_parents = (parent_name ? 1 : 0); @@ -161,4 +162,13 @@ struct clk *clk_register_gate(struct device *dev, const char *name, return clk; } +EXPORT_SYMBOL_GPL(clk_register_gate_ops); + +struct clk *clk_register_gate(struct device *dev, const char *name, + const char *parent_name, unsigned long flags, + void __iomem *reg, u8 bit_idx, + u8 clk_gate_flags, spinlock_t *lock) +{ + return clk_register_gate_ops(dev, name, parent_name, flags, reg, bit_idx, clk_gate_flags, lock, &clk_gate_ops); +} EXPORT_SYMBOL_GPL(clk_register_gate); diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h index be21af149f11..6cfc77a9f339 100644 --- a/include/linux/clk-provider.h +++ b/include/linux/clk-provider.h @@ -290,11 +290,16 @@ struct clk_gate { #define CLK_GATE_HIWORD_MASK BIT(1) extern const struct clk_ops clk_gate_ops; +struct clk *clk_register_gate_ops(struct device *dev, const char *name, + const char *parent_name, unsigned long flags, + void __iomem *reg, u8 bit_idx, + u8 clk_gate_flags, spinlock_t *lock, const struct clk_ops *ops); struct clk *clk_register_gate(struct device *dev, const char *name, const char *parent_name, unsigned long flags, void __iomem *reg, u8 bit_idx, u8 clk_gate_flags, spinlock_t *lock); + struct clk_div_table { unsigned int val; unsigned int div;