From patchwork Thu Dec 19 11:23:33 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tero Kristo X-Patchwork-Id: 3376911 Return-Path: X-Original-To: patchwork-linux-arm@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 A225E9F384 for ; Thu, 19 Dec 2013 11:25:58 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7B6B22061D for ; Thu, 19 Dec 2013 11:25:57 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8E55820619 for ; Thu, 19 Dec 2013 11:25:51 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VtbjM-0007C4-Jw; Thu, 19 Dec 2013 11:25:28 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1VtbjE-00049n-KS; Thu, 19 Dec 2013 11:25:20 +0000 Received: from devils.ext.ti.com ([198.47.26.153]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Vtbiv-00044p-HN for linux-arm-kernel@lists.infradead.org; Thu, 19 Dec 2013 11:25:04 +0000 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by devils.ext.ti.com (8.13.7/8.13.7) with ESMTP id rBJBOfc3009915; Thu, 19 Dec 2013 05:24:41 -0600 Received: from DLEE71.ent.ti.com (dlee71.ent.ti.com [157.170.170.114]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id rBJBOfZI014828; Thu, 19 Dec 2013 05:24:41 -0600 Received: from dflp33.itg.ti.com (10.64.6.16) by DLEE71.ent.ti.com (157.170.170.114) with Microsoft SMTP Server id 14.2.342.3; Thu, 19 Dec 2013 05:24:40 -0600 Received: from localhost.localdomain (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp33.itg.ti.com (8.14.3/8.13.8) with ESMTP id rBJBOUgu009888; Thu, 19 Dec 2013 05:24:38 -0600 From: Tero Kristo To: , , , , , , Subject: [PATCHv11 02/49] clk: fixed-rate: add support for registering fixed-rate clock from descriptor Date: Thu, 19 Dec 2013 13:23:33 +0200 Message-ID: <1387452260-23276-3-git-send-email-t-kristo@ti.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1387452260-23276-1-git-send-email-t-kristo@ti.com> References: <1387452260-23276-1-git-send-email-t-kristo@ti.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20131219_062501_744608_E2EFF685 X-CRM114-Status: GOOD ( 11.07 ) X-Spam-Score: -7.4 (-------) Cc: devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.7 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, 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 From: Mike Turquette New clk_register_desc() call can be used to register this clock type now. Signed-off-by: Mike Turquette Signed-off-by: Tero Kristo --- drivers/clk/clk-fixed-rate.c | 24 ++++++++++++++++++++++++ include/linux/clk-provider.h | 15 +++++++++++++++ 2 files changed, 39 insertions(+) diff --git a/drivers/clk/clk-fixed-rate.c b/drivers/clk/clk-fixed-rate.c index 1ed591a..d7aa01e 100644 --- a/drivers/clk/clk-fixed-rate.c +++ b/drivers/clk/clk-fixed-rate.c @@ -26,8 +26,12 @@ * parent - fixed parent. No clk_set_parent support */ +/* resolve struct clk_fixed_rate from inner struct clk_hw member */ #define to_clk_fixed_rate(_hw) container_of(_hw, struct clk_fixed_rate, hw) +/* resolve struct clk_fixed_rate_desc from inner struct clk_desc member */ +#define to_hw_desc(_desc) container_of(_desc, struct clk_fixed_rate_desc, desc) + static unsigned long clk_fixed_rate_recalc_rate(struct clk_hw *hw, unsigned long parent_rate) { @@ -82,6 +86,26 @@ struct clk *clk_register_fixed_rate(struct device *dev, const char *name, } EXPORT_SYMBOL_GPL(clk_register_fixed_rate); +struct clk_hw *clk_register_fixed_rate_desc(struct device *dev, + struct clk_desc *desc) +{ + struct clk_fixed_rate *fixed; + struct clk_fixed_rate_desc *hw_desc; + + hw_desc = to_hw_desc(desc); + + /* allocate fixed-rate clock */ + fixed = kzalloc(sizeof(*fixed), GFP_KERNEL); + if (!fixed) + return ERR_PTR(-ENOMEM); + + /* populate struct clk_fixed_rate assignments */ + fixed->fixed_rate = hw_desc->fixed_rate; + + return &fixed->hw; +} +EXPORT_SYMBOL_GPL(clk_register_fixed_rate_desc); + #ifdef CONFIG_OF /** * of_fixed_clk_setup() - Setup function for simple fixed rate clock diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h index 7fddcb3..82dfe84 100644 --- a/include/linux/clk-provider.h +++ b/include/linux/clk-provider.h @@ -219,6 +219,21 @@ struct clk_fixed_rate { u8 flags; }; +/** + * struct clk_fixed_rate_desc - fixed-rate clock description + * @desc: handle between common and hardware-specific interfaces + * @fixed_rate: constant frequency of clock + * @flags: hardware-specific flags + */ +struct clk_fixed_rate_desc { + struct clk_desc desc; + unsigned long fixed_rate; + u8 flags; +}; + +struct clk_hw *clk_register_fixed_rate_desc(struct device *dev, + struct clk_desc *desc); + extern const struct clk_ops clk_fixed_rate_ops; struct clk *clk_register_fixed_rate(struct device *dev, const char *name, const char *parent_name, unsigned long flags,