From patchwork Fri Aug 2 16:25:37 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tero Kristo X-Patchwork-Id: 2838126 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 914A59F3B8 for ; Fri, 2 Aug 2013 17:59:49 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9E570204AA for ; Fri, 2 Aug 2013 17:59:48 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 705C6204A3 for ; Fri, 2 Aug 2013 17:59:47 +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 1V5IEc-0006He-7n; Fri, 02 Aug 2013 16:29:46 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1V5IDz-00088Q-Cp; Fri, 02 Aug 2013 16:29:07 +0000 Received: from arroyo.ext.ti.com ([192.94.94.40]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1V5IC0-0007qj-SB for linux-arm-kernel@lists.infradead.org; Fri, 02 Aug 2013 16:27:27 +0000 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by arroyo.ext.ti.com (8.13.7/8.13.7) with ESMTP id r72GQlHc009427; Fri, 2 Aug 2013 11:26:47 -0500 Received: from DLEE71.ent.ti.com (dlee71.ent.ti.com [157.170.170.114]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id r72GQlx8013729; Fri, 2 Aug 2013 11:26:47 -0500 Received: from dlelxv22.itg.ti.com (172.17.1.197) by DLEE71.ent.ti.com (157.170.170.114) with Microsoft SMTP Server id 14.2.342.3; Fri, 2 Aug 2013 11:26:46 -0500 Received: from sokoban.tieu.ti.com (h78-17.vpn.ti.com [172.24.78.17]) by dlelxv22.itg.ti.com (8.13.8/8.13.8) with ESMTP id r72GQ2Tf003114; Fri, 2 Aug 2013 11:26:45 -0500 From: Tero Kristo To: , , , , , Subject: [PATCHv5 18/31] CLK: DT: add support for set-rate-parent flag Date: Fri, 2 Aug 2013 19:25:37 +0300 Message-ID: <1375460751-23676-19-git-send-email-t-kristo@ti.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1375460751-23676-1-git-send-email-t-kristo@ti.com> References: <1375460751-23676-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-20130802_122705_035599_52D18F51 X-CRM114-Status: UNSURE ( 7.41 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -8.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=-5.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 Adding set-rate-parent to clock node now allows a node to forward clk_set_rate request to its parent clock. Signed-off-by: Tero Kristo --- drivers/clk/clk-divider.c | 6 +++++- drivers/clk/clk-fixed-factor.c | 6 +++++- drivers/clk/clk-gate.c | 8 ++++++-- drivers/clk/clk-mux.c | 6 +++++- 4 files changed, 21 insertions(+), 5 deletions(-) diff --git a/drivers/clk/clk-divider.c b/drivers/clk/clk-divider.c index ff24ec2..01d967f 100644 --- a/drivers/clk/clk-divider.c +++ b/drivers/clk/clk-divider.c @@ -388,6 +388,7 @@ void of_divider_clk_setup(struct device_node *node) u32 mask = 0; u32 shift = 0; struct clk_div_table *table; + u32 flags = 0; of_property_read_string(node, "clock-output-names", &clk_name); @@ -418,12 +419,15 @@ void of_divider_clk_setup(struct device_node *node) if (of_property_read_bool(node, "hiword-mask")) clk_divider_flags |= CLK_DIVIDER_HIWORD_MASK; + if (of_property_read_bool(node, "set-rate-parent")) + flags |= CLK_SET_RATE_PARENT; + table = of_clk_get_div_table(node); if (IS_ERR(table)) return; clk = _register_divider(NULL, clk_name, - parent_name, 0, + parent_name, flags, reg, (u8) shift, mask, clk_divider_flags, table, NULL); diff --git a/drivers/clk/clk-fixed-factor.c b/drivers/clk/clk-fixed-factor.c index 9ff7d51..30aa121 100644 --- a/drivers/clk/clk-fixed-factor.c +++ b/drivers/clk/clk-fixed-factor.c @@ -107,6 +107,7 @@ void __init of_fixed_factor_clk_setup(struct device_node *node) const char *clk_name = node->name; const char *parent_name; u32 div, mult; + u32 flags = 0; if (of_property_read_u32(node, "clock-div", &div)) { pr_err("%s Fixed factor clock <%s> must have a clock-div property\n", @@ -123,7 +124,10 @@ void __init of_fixed_factor_clk_setup(struct device_node *node) of_property_read_string(node, "clock-output-names", &clk_name); parent_name = of_clk_get_parent_name(node, 0); - clk = clk_register_fixed_factor(NULL, clk_name, parent_name, 0, + if (of_property_read_bool(node, "set-rate-parent")) + flags |= CLK_SET_RATE_PARENT; + + clk = clk_register_fixed_factor(NULL, clk_name, parent_name, flags, mult, div); if (!IS_ERR(clk)) of_clk_add_provider(node, of_clk_src_simple_get, clk); diff --git a/drivers/clk/clk-gate.c b/drivers/clk/clk-gate.c index cd595ec..0be25b9 100644 --- a/drivers/clk/clk-gate.c +++ b/drivers/clk/clk-gate.c @@ -176,6 +176,7 @@ void of_gate_clk_setup(struct device_node *node) const char *parent_name; u8 clk_gate_flags = 0; u32 bit_idx = 0; + u32 flags = 0; of_property_read_string(node, "clock-output-names", &clk_name); @@ -195,8 +196,11 @@ void of_gate_clk_setup(struct device_node *node) if (of_property_read_bool(node, "hiword-mask")) clk_gate_flags |= CLK_GATE_HIWORD_MASK; - clk = clk_register_gate(NULL, clk_name, parent_name, 0, reg, (u8) bit_idx, - clk_gate_flags, NULL); + if (of_property_read_bool(node, "set-rate-parent")) + flags |= CLK_SET_RATE_PARENT; + + clk = clk_register_gate(NULL, clk_name, parent_name, flags, reg, + (u8) bit_idx, clk_gate_flags, NULL); if (!IS_ERR(clk)) of_clk_add_provider(node, of_clk_src_simple_get, clk); diff --git a/drivers/clk/clk-mux.c b/drivers/clk/clk-mux.c index 4751bce..890ddbf 100644 --- a/drivers/clk/clk-mux.c +++ b/drivers/clk/clk-mux.c @@ -184,6 +184,7 @@ void of_mux_clk_setup(struct device_node *node) u8 clk_mux_flags = 0; u32 mask = 0; u32 shift = 0; + u32 flags = 0; of_property_read_string(node, "clock-output-names", &clk_name); @@ -219,8 +220,11 @@ void of_mux_clk_setup(struct device_node *node) if (of_property_read_bool(node, "hiword-mask")) clk_mux_flags |= CLK_MUX_HIWORD_MASK; + if (of_property_read_bool(node, "set-rate-parent")) + flags |= CLK_SET_RATE_PARENT; + clk = clk_register_mux_table(NULL, clk_name, parent_names, num_parents, - 0, reg, (u8) shift, mask, clk_mux_flags, + flags, reg, (u8) shift, mask, clk_mux_flags, NULL, NULL); if (!IS_ERR(clk))