From patchwork Thu Feb 11 21:19:09 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Turquette X-Patchwork-Id: 61808 Delivered-To: patch@linaro.org Received: by 10.112.43.199 with SMTP id y7csp447841lbl; Thu, 11 Feb 2016 13:19:48 -0800 (PST) X-Received: by 10.66.251.68 with SMTP id zi4mr17210786pac.113.1455225588032; Thu, 11 Feb 2016 13:19:48 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id aj1si14753195pad.244.2016.02.11.13.19.47; Thu, 11 Feb 2016 13:19:47 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751706AbcBKVTm (ORCPT + 30 others); Thu, 11 Feb 2016 16:19:42 -0500 Received: from mail-pf0-f178.google.com ([209.85.192.178]:34545 "EHLO mail-pf0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751103AbcBKVTi (ORCPT ); Thu, 11 Feb 2016 16:19:38 -0500 Received: by mail-pf0-f178.google.com with SMTP id x65so35489325pfb.1 for ; Thu, 11 Feb 2016 13:19:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=DqccumEm3bbcsTPrKmEzIWVszQcxBn0+LVwoBE1fehU=; b=f4mvHJpJqZXPoEc8STzVBKTRJnXIg9rFyWJ7nzDp5cwP0lfc9jijpVL86cwPWpmPp2 3ePueZAjz9/miK7SJqrGXyipCrzL+ixtQZnO5P4So/Zp6UhRUeMVVQNyGaP6+aTA979r xGvmU1x/mdABuMXkDblr7EYlAaUCDRKFo3YlrqCA11Lowq5tPkaVokTOsrAr61dicT8V 0q9OsVeq/5Sc1KWki3ogwD92ZmhQ7eeZFzaV5HPcD5Zb+aIoCHug9EMWWPjbB2XEYLLF 0yIOV6UAhA3cXEBPWYRmaTXdzJLW5gVUW/HaN1MnOo2k8uFmQhTglkaw0cnowza1sRXp C4wA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=DqccumEm3bbcsTPrKmEzIWVszQcxBn0+LVwoBE1fehU=; b=Ni5ABhwemeZAB4z2Lwa68mNbzFSvPMUjiN43ygav43eBB+oKXU3xumy4G8z7+CsEXD 0qIlNHo6kidN2J2L3870QtEo7Ln9BeJk40FgbWayRMJGj6zERUqb3dKZu5x64xfSEjug 0WCZpbJ9LQFZIroxpjfEnmoTuVXSUYOboHFp9olGgB5Qa9wYmcz3VntlkfhnqVVOSJGw nCZofxB5sxCrzR/PvJg3kTg/dRFgMrgke8mbarqSh7wS0lycL0KPuIzi4UR/jF7zhFda JNLlarDslyVZOsEM/tf5JrjEDZJJafWMZMv8mDIn2La0bhKXbLR/l5IA/082Pb0+nOF1 W57g== X-Gm-Message-State: AG10YOR2KlWmg4xwbBCSF8hM8HExYQqpCPbBeuBDVBf2n3XUmK1MpXRUqXEG5Z0uiOXcHGF9 X-Received: by 10.98.93.211 with SMTP id n80mr12961984pfj.61.1455225578430; Thu, 11 Feb 2016 13:19:38 -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 v75sm14374452pfa.39.2016.02.11.13.19.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 11 Feb 2016 13:19:37 -0800 (PST) From: Michael Turquette To: linux-clk@vger.kernel.org Cc: lee.jones@linaro.org, sboyd@codeaurora.org, maxime.ripard@free-electrons.com, maxime.coquelin@st.com, geert@linux-m68k.org, heiko@sntech.de, andre.przywara@arm.com, rklein@nvidia.com, linux-kernel@vger.kernel.org, Michael Turquette Subject: [PATCH v42 1/6] clk: Allow clocks to be marked as CRITICAL Date: Thu, 11 Feb 2016 13:19:09 -0800 Message-Id: <1455225554-13267-2-git-send-email-mturquette@baylibre.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1455225554-13267-1-git-send-email-mturquette@baylibre.com> References: <1455225554-13267-1-git-send-email-mturquette@baylibre.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Lee Jones Critical clocks are those which must not be gated, else undefined or catastrophic failure would occur. Here we have chosen to ensure the prepare/enable counts are correctly incremented, so as not to confuse users with enabled clocks with no visible users. Signed-off-by: Lee Jones Signed-off-by: Michael Turquette --- Changes in v42: * Moved code from clk_register into __clk_init drivers/clk/clk.c | 5 +++++ include/linux/clk-provider.h | 1 + 2 files changed, 6 insertions(+) -- 2.1.4 diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c index b4db67a..993f775 100644 --- a/drivers/clk/clk.c +++ b/drivers/clk/clk.c @@ -2484,6 +2484,11 @@ static int __clk_init(struct device *dev, struct clk *clk_user) if (core->ops->init) core->ops->init(core->hw); + if (core->flags & CLK_IS_CRITICAL) { + clk_core_prepare(core); + clk_core_enable(core); + } + kref_init(&core->ref); out: clk_prepare_unlock(); diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h index 1143e38..1d986ea 100644 --- a/include/linux/clk-provider.h +++ b/include/linux/clk-provider.h @@ -32,6 +32,7 @@ #define CLK_GET_ACCURACY_NOCACHE BIT(8) /* do not use the cached clk accuracy */ #define CLK_RECALC_NEW_RATES BIT(9) /* recalc rates after notifications */ #define CLK_SET_RATE_UNGATE BIT(10) /* clock needs to run to set rate */ +#define CLK_IS_CRITICAL BIT(11) /* do not gate, ever */ struct clk; struct clk_hw;