From patchwork Fri May 23 13:02:15 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Abraham X-Patchwork-Id: 4232661 Return-Path: X-Original-To: patchwork-linux-arm@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 CE8F3BF90B for ; Fri, 23 May 2014 13:06:57 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id F05F4203A0 for ; Fri, 23 May 2014 13:06: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 74FC620148 for ; Fri, 23 May 2014 13:06: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 1Wnp9U-0004mg-H6; Fri, 23 May 2014 13:04:48 +0000 Received: from mailout1.samsung.com ([203.254.224.24]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Wnp9Q-0004ZT-Rm for linux-arm-kernel@lists.infradead.org; Fri, 23 May 2014 13:04:46 +0000 Received: from epcpsbgr2.samsung.com (u142.gpu120.samsung.co.kr [203.254.230.142]) by mailout1.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0N6100GI42Z14C90@mailout1.samsung.com> for linux-arm-kernel@lists.infradead.org; Fri, 23 May 2014 22:04:13 +0900 (KST) Received: from epcpsbgm2.samsung.com ( [172.20.52.124]) by epcpsbgr2.samsung.com (EPCPMTA) with SMTP id 09.B7.19452.D474F735; Fri, 23 May 2014 22:04:13 +0900 (KST) X-AuditID: cbfee68e-b7fb96d000004bfc-5a-537f474daaa7 Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id 87.A4.07139.C474F735; Fri, 23 May 2014 22:04:13 +0900 (KST) Received: from chromebld-server.sisodomain.com ([107.108.73.106]) by mmp2.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0N61004HN2XUD3A0@mmp2.samsung.com>; Fri, 23 May 2014 22:04:12 +0900 (KST) From: Thomas Abraham To: mturquette@linaro.org Subject: [PATCH] clk: divider: add CLK_DIVIDER_READ_ONLY flag Date: Fri, 23 May 2014 18:32:15 +0530 Message-id: <1400850135-20382-1-git-send-email-thomas.ab@samsung.com> X-Mailer: git-send-email 1.7.9.5 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrOLMWRmVeSWpSXmKPExsWyRsSkRtfXvT7YoO8mt8X/R69ZLTY9vsZq 8XTCRTaLjmWMDiwed67tYfPYvKTeo2/LKkaP7dfmMQewRHHZpKTmZJalFunbJXBlvDh6nLFg vVjF1N27WBoYLwl1MXJwSAiYSHybYdvFyAlkiklcuLeerYuRi0NIYCmjxKHj+9ghEiYSfzZs ZYFITGeUOPjhJytIQkhgApPE0oP2IDabgI7EjTe/GUFsEQFJiQefp7OA2MwCyRI9DavB4sIC thJP5j0B62URUJXYeO0O2AJeAVeJB6s72CEOUpCYM8kGZJeEwHM2iZPbTkDVC0h8m3yIBaJG VmLTAWaI2yQlDq64wTKBUXABI8MqRtHUguSC4qT0IiO94sTc4tK8dL3k/NxNjMBAPP3vWd8O xpsHrA8xJgONm8gsJZqcDwzkvJJ4Q2MzIwtTE1NjI3NLM9KElcR5Fz1MChISSE8sSc1OTS1I LYovKs1JLT7EyMTBKdXA2NWkK8aUVpj1mY+Zq383i6L+xoV15YfFeN+IdSl/4kxQkp3t2mBU yRa9X/S6tpj4cTGmPYusfiw3iddNP/PJ/1nOMu+pETVLE9+3J5/l3fGtUyZUqeF5+ZVJxTUF ByeHOmxsbX5vnRt2/WmIDvuOW3kfG+zPvwr4fdpoD2+P3MNHLTr769iVWIozEg21mIuKEwFs vGMkWgIAAA== X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrKIsWRmVeSWpSXmKPExsVy+t9jQV1f9/pgg11LGS3+P3rNarHp8TVW i6cTLrJZdCxjdGDxuHNtD5vH5iX1Hn1bVjF6bL82jzmAJaqB0SYjNTEltUghNS85PyUzL91W yTs43jne1MzAUNfQ0sJcSSEvMTfVVsnFJ0DXLTMHaKWSQlliTilQKCCxuFhJ3w7ThNAQN10L mMYIXd+QILgeIwM0kLCGMePF0eOMBevFKqbu3sXSwHhJqIuRk0NCwETiz4atLBC2mMSFe+vZ uhi5OIQEpjNKHPzwkxUkISQwgUli6UF7EJtNQEfixpvfjCC2iICkxIPP08GamQWSJXoaVoPF hQVsJZ7MewLWyyKgKrHx2h12EJtXwFXiweoOIJsDaJmCxJxJNhMYuRcwMqxiFE0tSC4oTkrP NdIrTswtLs1L10vOz93ECA70Z9I7GFc1WBxiFOBgVOLhfcBUFyzEmlhWXJl7iFGCg1lJhJfL tT5YiDclsbIqtSg/vqg0J7X4EGMy0PKJzFKiyfnAKMwriTc0NjE3NTa1NLEwMbMkTVhJnPdg q3WgkEB6YklqdmpqQWoRzBYmDk6pBsaM1E7N1YYnryT1TJzIxp4lzBH9MW3Sji1Rb/rVswJW LpLR+pPXsv/EE4ZZ/Lentsv9+JxhxnXIgO/pm41zlWRSwy+F8MTWpNsbXPo8798fdneGV2u8 LzBLnfj05wFf2mMlrTj9WK+EmYk+RS3Gyu17urLNfr0L61+Q3qpysnyy9p2ji9f/eKDEUpyR aKjFXFScCABuy1M7uAIAAA== DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140523_060445_076742_3451685E X-CRM114-Status: GOOD ( 13.04 ) X-Spam-Score: -5.7 (-----) Cc: Thomas Abraham , heiko@sntech.de, 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: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,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: Heiko Stuebner From: Heiko Stuebner Similar to muxes which already have a read-only flag there sometimes exist dividers which should not be changed by the clock framework but whose value still should be readable. Therefore add a READ_ONLY flag similar to the mux-one to clk-divider Signed-off-by: Heiko Stuebner [changed flag bit to BIT(5) as suggested by Tomasz Figa] Signed-off-by: Thomas Abraham Acked-by: Tomasz Figa Acked-by: Max Schwarz Tested-by: Max Schwarz --- drivers/clk/clk-divider.c | 10 +++++++++- include/linux/clk-provider.h | 4 ++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/drivers/clk/clk-divider.c b/drivers/clk/clk-divider.c index b3c8396..c9343f5 100644 --- a/drivers/clk/clk-divider.c +++ b/drivers/clk/clk-divider.c @@ -361,6 +361,11 @@ const struct clk_ops clk_divider_ops = { }; EXPORT_SYMBOL_GPL(clk_divider_ops); +const struct clk_ops clk_divider_ro_ops = { + .recalc_rate = clk_divider_recalc_rate, +}; +EXPORT_SYMBOL_GPL(clk_divider_ro_ops); + static struct clk *_register_divider(struct device *dev, const char *name, const char *parent_name, unsigned long flags, void __iomem *reg, u8 shift, u8 width, @@ -386,7 +391,10 @@ static struct clk *_register_divider(struct device *dev, const char *name, } init.name = name; - init.ops = &clk_divider_ops; + if (clk_divider_flags & CLK_DIVIDER_READ_ONLY) + init.ops = &clk_divider_ro_ops; + else + init.ops = &clk_divider_ops; init.flags = flags | CLK_IS_BASIC; init.parent_names = (parent_name ? &parent_name: NULL); init.num_parents = (parent_name ? 1 : 0); diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h index 4080943..c7135db 100644 --- a/include/linux/clk-provider.h +++ b/include/linux/clk-provider.h @@ -320,6 +320,8 @@ struct clk_div_table { * updated to indicate changing divider bits. * CLK_DIVIDER_ROUND_CLOSEST - Makes the best calculated divider to be rounded * to the closest integer instead of the up one. + * CLK_DIVIDER_READ_ONLY - The divider settings are preconfigured and should + * not be changed by the clock framework. */ struct clk_divider { struct clk_hw hw; @@ -336,8 +338,10 @@ struct clk_divider { #define CLK_DIVIDER_ALLOW_ZERO BIT(2) #define CLK_DIVIDER_HIWORD_MASK BIT(3) #define CLK_DIVIDER_ROUND_CLOSEST BIT(4) +#define CLK_DIVIDER_READ_ONLY BIT(5) extern const struct clk_ops clk_divider_ops; +extern const struct clk_ops clk_divider_ro_ops; struct clk *clk_register_divider(struct device *dev, const char *name, const char *parent_name, unsigned long flags, void __iomem *reg, u8 shift, u8 width,