From patchwork Thu Feb 11 00:48:53 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Turquette X-Patchwork-Id: 8275861 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.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id D95E89F3CD for ; Thu, 11 Feb 2016 00:50:52 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D43F220260 for ; Thu, 11 Feb 2016 00:50:51 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id AAEC4201E4 for ; Thu, 11 Feb 2016 00:50:50 +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 1aTfRg-0001CS-IC; Thu, 11 Feb 2016 00:49:20 +0000 Received: from mail-pf0-x22c.google.com ([2607:f8b0:400e:c00::22c]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1aTfRd-00010i-60 for linux-arm-kernel@lists.infradead.org; Thu, 11 Feb 2016 00:49:18 +0000 Received: by mail-pf0-x22c.google.com with SMTP id q63so20523992pfb.0 for ; Wed, 10 Feb 2016 16:48:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=content-type:mime-version:content-transfer-encoding:to:from :in-reply-to:cc:references:message-id:user-agent:subject:date; bh=Vi62+SHpgCl5RfQBMd54dPRpgDplOj3YqPUqpGxvNFU=; b=1Sk9giuI0sWP3pxyT8ZzGk2YsVvYUyXZmFmmCeZ/jVM+LqCXcnLhVxSQl3mvmgEUKo j0MBV/Ikd3h6I6yCsolMpPQ+W+3Lapn5/KiauZKdwjpW+YR3KlvmyCy730bDOHr+kG49 eDlxXtPu/Q3C7sXho4tBmLUbkccOd8Ir6g8Oan1rDT1K+dPQUMehoFz02T0uhoCwofTk DMfHg5T0yIOq7hx1jLLUR4AmB1HyPHEDUNGoDahGTO1k9t1Hv+/qX7mBufXPdpKZgP2p fpT9KTP4f8Lm/OiqxHgvADxj03bBGlzBjbQD4Hxsx4DdScZISBIbycFglyC2eYBRleNh seLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:content-type:mime-version :content-transfer-encoding:to:from:in-reply-to:cc:references :message-id:user-agent:subject:date; bh=Vi62+SHpgCl5RfQBMd54dPRpgDplOj3YqPUqpGxvNFU=; b=OB1iqw44rhWmdW22xyy3oavd88Qd1f5wT6yomWMSO3cgT9JmrSlK+SPvWmbCG80oQw IT4P1dsp6p4xOLyM4MBUS7MaFdwkAHOyJtvxVs3+K8R1+ulBUhMGTjJOc0u9UQNjHegX PO0iHpDZdbPdB8+MHRlabLYxxyA5anHfXtvkb4MXuDDsQyZzOdgqB40adKvIq10ruifX I/bS1Ij++ftTfhnpRL8g9oq0mc0VXx/pqlFCIlg3JZd+5Y5ow0BjGevmyckFPWXYWtCs s8fyBNRPoVHvykW+O7HITjq9K71AeF5SkiwHIUN0VLpU4BSJE6ps5C4dSAAfnHjrvcF1 k2iA== X-Gm-Message-State: AG10YOTsUcrleY0utpsT2LAeyvcQM8E4UO90jpseSC3MiamUpfF+KL0T7lmthiw/yGJ8xhzK X-Received: by 10.98.93.1 with SMTP id r1mr11134292pfb.57.1455151736212; Wed, 10 Feb 2016 16:48:56 -0800 (PST) Received: from localhost (cpe-172-248-200-249.socal.res.rr.com. [172.248.200.249]) by smtp.gmail.com with ESMTPSA id d8sm7782539pas.14.2016.02.10.16.48.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 10 Feb 2016 16:48:54 -0800 (PST) MIME-Version: 1.0 To: Lee Jones , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org From: Michael Turquette In-Reply-To: <1453127331-20616-4-git-send-email-lee.jones@linaro.org> References: <1453127331-20616-1-git-send-email-lee.jones@linaro.org> <1453127331-20616-4-git-send-email-lee.jones@linaro.org> Message-ID: <20160211004853.26445.85326@quark.deferred.io> User-Agent: alot/0.3.6 Subject: Re: [PATCH 3/3] clk: Provide OF helper to mark clocks as CRITICAL Date: Wed, 10 Feb 2016 16:48:53 -0800 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160210_164917_378765_84C4E1D5 X-CRM114-Status: GOOD ( 19.93 ) X-Spam-Score: -1.9 (-) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kernel@stlinux.com, s.hauer@pengutronix.de, sboyd@codeaurora.org, geert@linux-m68k.org, maxime.ripard@free-electrons.com, Lee Jones , maxime.coquelin@st.com Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID,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 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 > --- > 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 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 Signed-off-by: Michael Turquette --- 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 */