From patchwork Tue Nov 4 07:52:37 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kever Yang X-Patchwork-Id: 5223461 Return-Path: X-Original-To: patchwork-linux-rockchip@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 8A3F1C11AC for ; Tue, 4 Nov 2014 07:55:57 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9A1FA20108 for ; Tue, 4 Nov 2014 07:55:56 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (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 C68FD200F3 for ; Tue, 4 Nov 2014 07:55:55 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1XlYy3-00063g-7x; Tue, 04 Nov 2014 07:55:55 +0000 Received: from mail-pd0-x22e.google.com ([2607:f8b0:400e:c02::22e]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1XlYxo-0005fX-8y; Tue, 04 Nov 2014 07:55:41 +0000 Received: by mail-pd0-f174.google.com with SMTP id p10so13049803pdj.5 for ; Mon, 03 Nov 2014 23:55:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=M0Xzrp+ZOFGS964DjWRaIssbm+NzPrFuesNBXAAzU4s=; b=m9/ELSTuJRiB09Ax3Q5kNbsBjWn4GGGvyo4OgJFOT4q/t0vEARQLe7oBV+zhNHGl2D ee5X4jBusRCs/3rIqOdJZDTPVXMDwDo1LBnIGBJdu5dwpsIkRqsXX6p9/kqRwkwHOje9 lGdIthogwKwPwRNqwoOuCWUF6R4r2VpRFoAgjHub56qDO6P6/l2a+kztBwVj8R8tWj7T SWD1uhGuhmSZFzMC466TqEy6d5v+YEwtvWdQMVEPQRBYRzpuW29vIG4N0OKLmKyMQXIL sJpqcrcy5FlzAQexT5jzftWF3sLUs0Lfo1Z6CddJkrAHE2Tks7J/2zThiAbEbvmCtFi+ oxcQ== X-Received: by 10.68.226.226 with SMTP id rv2mr48723181pbc.77.1415087718801; Mon, 03 Nov 2014 23:55:18 -0800 (PST) Received: from localhost.localdomain ([58.22.7.114]) by mx.google.com with ESMTPSA id r4sm16197953pdm.93.2014.11.03.23.55.10 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 03 Nov 2014 23:55:17 -0800 (PST) From: Kever Yang To: Mike Turquette , Heiko Stuebner Subject: [PATCH 3/5] clk: rockchip: introduce the div_ops handling for composite branches Date: Tue, 4 Nov 2014 15:52:37 +0800 Message-Id: <1415087559-19444-4-git-send-email-kever.yang@rock-chips.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1415087559-19444-1-git-send-email-kever.yang@rock-chips.com> References: <1415087559-19444-1-git-send-email-kever.yang@rock-chips.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20141103_235540_372330_E185C5C1 X-CRM114-Status: GOOD ( 11.56 ) X-Spam-Score: 1.0 (+) Cc: huangtao@rock-chips.com, dkl@rock-chips.com, addy.ke@rock-chips.com, yzq@rock-chips.com, linux-kernel@vger.kernel.org, dianders@chromium.org, Kever Yang , linux-rockchip@lists.infradead.org, fzf@rock-chips.com, ykk@rock-chips.com, cf@rock-chips.com, sonnyrao@chromium.org, linux-arm-kernel@lists.infradead.org X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-0.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_NONE, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY, URIBL_BLACK autolearn=no 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 Rockchip Socs have a lot of clock node registered as composite branch which include mux, divider and gate, most of them use the same ops handling callback, we still need special ops handling for some special clock node and this patch make it possible. Signed-off-by: Kever Yang --- drivers/clk/rockchip/clk.c | 13 +++++++++---- drivers/clk/rockchip/clk.h | 24 ++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 4 deletions(-) diff --git a/drivers/clk/rockchip/clk.c b/drivers/clk/rockchip/clk.c index 1e68bff..0917c2b 100644 --- a/drivers/clk/rockchip/clk.c +++ b/drivers/clk/rockchip/clk.c @@ -42,6 +42,7 @@ static struct clk *rockchip_clk_register_branch(const char *name, const char **parent_names, u8 num_parents, void __iomem *base, int muxdiv_offset, u8 mux_shift, u8 mux_width, u8 mux_flags, u8 div_shift, u8 div_width, u8 div_flags, + const struct clk_ops *divops, struct clk_div_table *div_table, int gate_offset, u8 gate_shift, u8 gate_flags, unsigned long flags, spinlock_t *lock) @@ -90,9 +91,12 @@ static struct clk *rockchip_clk_register_branch(const char *name, div->width = div_width; div->lock = lock; div->table = div_table; - div_ops = (div_flags & CLK_DIVIDER_READ_ONLY) - ? &clk_divider_ro_ops - : &clk_divider_ops; + if (divops) + div_ops = divops; + else if (div_flags & CLK_DIVIDER_READ_ONLY) + div_ops = &clk_divider_ro_ops; + else + div_ops = &clk_divider_ops; } clk = clk_register_composite(NULL, name, parent_names, num_parents, @@ -275,7 +279,8 @@ void __init rockchip_clk_register_branches( reg_base, list->muxdiv_offset, list->mux_shift, list->mux_width, list->mux_flags, list->div_shift, list->div_width, - list->div_flags, list->div_table, + list->div_flags, + list->div_ops, list->div_table, list->gate_offset, list->gate_shift, list->gate_flags, flags, &clk_lock); break; diff --git a/drivers/clk/rockchip/clk.h b/drivers/clk/rockchip/clk.h index 6baf665..2cf263b 100644 --- a/drivers/clk/rockchip/clk.h +++ b/drivers/clk/rockchip/clk.h @@ -185,6 +185,7 @@ struct rockchip_clk_branch { u8 div_shift; u8 div_width; u8 div_flags; + const struct clk_ops *div_ops; struct clk_div_table *div_table; int gate_offset; u8 gate_shift; @@ -212,6 +213,29 @@ struct rockchip_clk_branch { .gate_flags = gf, \ } +#define COMPOSITE_DIVOPS(_id, cname, pnames, f, mo, ms, mw, mf, \ + ds, dw, df, dops, go, gs, gf) \ + { \ + .id = _id, \ + .branch_type = branch_composite, \ + .name = cname, \ + .parent_names = pnames, \ + .num_parents = ARRAY_SIZE(pnames), \ + .flags = f, \ + .muxdiv_offset = mo, \ + .mux_shift = ms, \ + .mux_width = mw, \ + .mux_flags = mf, \ + .div_shift = ds, \ + .div_width = dw, \ + .div_flags = df, \ + .div_ops = dops, \ + .gate_offset = go, \ + .gate_shift = gs, \ + .gate_flags = gf, \ + } + + #define COMPOSITE_NOMUX(_id, cname, pname, f, mo, ds, dw, df, \ go, gs, gf) \ { \