From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755418AbcARObK (ORCPT ); Mon, 18 Jan 2016 09:31:10 -0500 Received: from mail-wm0-f53.google.com ([74.125.82.53]:34438 "EHLO mail-wm0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755215AbcARObD (ORCPT ); Mon, 18 Jan 2016 09:31:03 -0500 From: Lee Jones To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: kernel@stlinux.com, maxime.coquelin@st.com, mturquette@baylibre.com, sboyd@codeaurora.org, maxime.ripard@free-electrons.com, s.hauer@pengutronix.de, geert@linux-m68k.org, Lee Jones Subject: [PATCH 3/3] clk: Provide OF helper to mark clocks as CRITICAL Date: Mon, 18 Jan 2016 14:28:51 +0000 Message-Id: <1453127331-20616-4-git-send-email-lee.jones@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1453127331-20616-1-git-send-email-lee.jones@linaro.org> References: <1453127331-20616-1-git-send-email-lee.jones@linaro.org> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This call matches clocks which have been marked as critical in DT and sets the appropriate flag. These flags can then be used to mark the clock core flags appropriately prior to registration. Signed-off-by: Lee Jones --- include/linux/clk-provider.h | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h index ffa0b2e..6f178b7 100644 --- a/include/linux/clk-provider.h +++ b/include/linux/clk-provider.h @@ -707,6 +707,23 @@ const char *of_clk_get_parent_name(struct device_node *np, int index); void of_clk_init(const struct of_device_id *matches); +static inline int of_clk_mark_if_critical(struct device_node *np, + int index, unsigned long *flags) +{ + struct property *prop; + const __be32 *cur; + uint32_t idx; + + if (!np || !flags) + return -EINVAL; + + of_property_for_each_u32(np, "critical-clock", prop, cur, idx) + if (index == idx) + *flags |= CLK_IS_CRITICAL; + + return 0; +} + #else /* !CONFIG_OF */ static inline int of_clk_add_provider(struct device_node *np, @@ -742,6 +759,11 @@ static inline const char *of_clk_get_parent_name(struct device_node *np, { return NULL; } +static inline int of_clk_mark_if_critical(struct device_node *np, int index, + unsigned long *flags) +{ + return 0; +} #define of_clk_init(matches) \ { while (0); } #endif /* CONFIG_OF */ -- 1.9.1