From: Michael Turquette <mturquette@baylibre.com>
To: Lee Jones <lee.jones@linaro.org>,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org
Cc: kernel@stlinux.com, maxime.coquelin@st.com, sboyd@codeaurora.org,
maxime.ripard@free-electrons.com, s.hauer@pengutronix.de,
geert@linux-m68k.org, "Lee Jones" <lee.jones@linaro.org>
Subject: Re: [PATCH 3/3] clk: Provide OF helper to mark clocks as CRITICAL
Date: Wed, 10 Feb 2016 16:48:53 -0800 [thread overview]
Message-ID: <20160211004853.26445.85326@quark.deferred.io> (raw)
In-Reply-To: <1453127331-20616-4-git-send-email-lee.jones@linaro.org>
Quoting Lee Jones (2016-01-18 06:28:51)
> 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 <lee.jones@linaro.org>
> ---
> 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);
>
Added kerneldoc here outlining who should use this (legacy DT bindings
and no one else).
> +static inline int of_clk_mark_if_critical(struct device_node *np,
> + int index, unsigned long *flags)
Moved this to clk.c, uninlined it and unstaticized it. Renamed beastly
function name to of_clk_detect_critical.
> +{
> + 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)
Changed property name to clock-critical to better match its siblings.
Modified patch below.
Best regards,
Mike
>From 42df0a24d3c0bfd321e867e4113214160f17fadc Mon Sep 17 00:00:00 2001
From: Lee Jones <lee.jones@linaro.org>
Date: Mon, 18 Jan 2016 14:28:51 +0000
Subject: [PATCH 3/6] clk: Provide OF helper to mark clocks as CRITICAL
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 <lee.jones@linaro.org>
Signed-off-by: Michael Turquette <mturquette@baylibre.com>
---
drivers/clk/clk.c | 35 +++++++++++++++++++++++++++++++++++
include/linux/clk-provider.h | 8 +++++++-
2 files changed, 42 insertions(+), 1 deletion(-)
diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index 39f9527..5181a15 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -3202,6 +3202,41 @@ static int parent_ready(struct device_node *np)
}
/**
+ * of_clk_detect_critical() - set CLK_IS_CRITICAL flag from Device Tree
+ * @np: Device node pointer associated with clock provider
+ * @index: clock index
+ * @flags: pointer to clk_core->flags
+ *
+ * Detects if the clock-critical property exists and, if so, sets the
+ * corresponding CLK_IS_CRITICAL flag.
+ *
+ * Do not use this function. It exists only for legacy Device Tree
+ * bindings, such as the one-clock-per-node style that are outdated.
+ * Those bindings typically put all clock data into .dts and the Linux
+ * driver has no clock data, thus making it impossible to set this flag
+ * correctly from the driver. Only those drivers may call
+ * of_clk_detect_critical from their setup functions.
+ *
+ * Return: error code or zero on success
+ */
+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, "clock-critical", prop, cur, idx)
+ if (index == idx)
+ *flags |= CLK_IS_CRITICAL;
+
+ return 0;
+}
+
+/**
* of_clk_init() - Scan and init clock providers from the DT
* @matches: array of compatible values and init functions for providers.
*
diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h
index 1d986ea..d15d3cc 100644
--- a/include/linux/clk-provider.h
+++ b/include/linux/clk-provider.h
@@ -705,7 +705,8 @@ int of_clk_get_parent_count(struct device_node *np);
int of_clk_parent_fill(struct device_node *np, const char **parents,
unsigned int size);
const char *of_clk_get_parent_name(struct device_node *np, int index);
-
+int of_clk_mark_if_critical(struct device_node *np, int index,
+ unsigned long *flags);
void of_clk_init(const struct of_device_id *matches);
#else /* !CONFIG_OF */
@@ -742,6 +743,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;
+}
static inline void of_clk_init(const struct of_device_id *matches) {}
#endif /* CONFIG_OF */
--
2.1.4
next prev parent reply other threads:[~2016-02-11 0:48 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-18 14:28 [PATCH 0/3] clk: Add support for critical clocks Lee Jones
2016-01-18 14:28 ` [PATCH 1/3] clk: Allow clocks to be marked as CRITICAL Lee Jones
2016-01-18 17:15 ` Geert Uytterhoeven
2016-01-19 7:53 ` Lee Jones
2016-02-11 0:41 ` Michael Turquette
2016-01-18 14:28 ` [PATCH 2/3] clk: WARN_ON about to disable a critical clock Lee Jones
2016-02-11 0:43 ` Michael Turquette
2017-06-27 11:16 ` Dirk Behme
2017-07-03 11:53 ` Lee Jones
2017-07-03 12:01 ` Dirk Behme
2017-07-03 14:25 ` Lee Jones
2017-07-03 15:24 ` Dirk Behme
2017-07-03 16:06 ` Lee Jones
2016-01-18 14:28 ` [PATCH 3/3] clk: Provide OF helper to mark clocks as CRITICAL Lee Jones
2016-01-27 23:51 ` André Przywara
2016-02-01 6:32 ` Maxime Ripard
2016-02-01 8:22 ` Lee Jones
2016-02-11 0:38 ` Michael Turquette
2016-02-02 13:39 ` Andre Przywara
2016-02-02 15:02 ` Lee Jones
2016-02-11 0:48 ` Michael Turquette [this message]
2016-02-11 1:00 ` [PATCH 0/3] clk: Add support for critical clocks Michael Turquette
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160211004853.26445.85326@quark.deferred.io \
--to=mturquette@baylibre.com \
--cc=geert@linux-m68k.org \
--cc=kernel@stlinux.com \
--cc=lee.jones@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maxime.coquelin@st.com \
--cc=maxime.ripard@free-electrons.com \
--cc=s.hauer@pengutronix.de \
--cc=sboyd@codeaurora.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®