From patchwork Mon Jan 18 14:28:49 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 59932 Delivered-To: patch@linaro.org Received: by 10.112.130.2 with SMTP id oa2csp2029236lbb; Mon, 18 Jan 2016 06:31:21 -0800 (PST) X-Received: by 10.66.189.200 with SMTP id gk8mr36903534pac.36.1453127480031; Mon, 18 Jan 2016 06:31:20 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t64si40058981pfi.43.2016.01.18.06.31.19; Mon, 18 Jan 2016 06:31:20 -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=@linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755434AbcARObO (ORCPT + 29 others); Mon, 18 Jan 2016 09:31:14 -0500 Received: from mail-wm0-f54.google.com ([74.125.82.54]:37374 "EHLO mail-wm0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755347AbcARObB (ORCPT ); Mon, 18 Jan 2016 09:31:01 -0500 Received: by mail-wm0-f54.google.com with SMTP id n5so66813291wmn.0 for ; Mon, 18 Jan 2016 06:31:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=F3SPGtP05hKi6WOul0Zdq2q74/WBD+b9svqgQ1Kph3E=; b=IXsAMnt1CiTy54Xa4Nuwmfld087FPfU5umtu533oqTKfNyeuyHLviwN/oDYmlJd3Vf q3lcVRdMwAX5a6RFHrP2cykS2xVdvmGJJVhyqGpPrBAjPkbStHPjBVHL157jkGlMPAwO tHOGLHWb2o/K2Ck1K7fOLVoAOiDep24wmbwPE= 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=F3SPGtP05hKi6WOul0Zdq2q74/WBD+b9svqgQ1Kph3E=; b=OYkh/N9hk7sncKtQCds+KE9zNNppcEAXh0Hn6uwvVS6Z777YKpAUrW2tR80nHRG8Pc +Z4SqLrnpI3201eeuHSD5TUzrQkLKT4u11ktPHFQ11St8vE7H3k5zLxkrBrDP34DWDiI azhVcHfLrirYMmzSlgOah4bjmX/+Av1aCfaYOvh7z6iCdxG850Gu9VKrYvgtbI3AhJsa XnQJ4iV3OergpNwbLN0Ked0lzNg4pTsvs0WR2SiLdUcP1rIejFxCcMKAZkfxOUBbMsUz JVYkFm1gpzQ+Qfbw8WP402PJiNOqkS+okFV0JvEoYhYTSivaAAGyXwKfOxaLgyigikBj YYVg== X-Gm-Message-State: AG10YOTDl1O4XPGcWNl0n3exbxptoeuVRA4/vKxX2B69KEL6x67ZQh0wKfFE3uqx6TDdgxOp X-Received: by 10.28.218.78 with SMTP id r75mr14219203wmg.7.1453127459850; Mon, 18 Jan 2016 06:30:59 -0800 (PST) Received: from localhost.localdomain (host81-129-171-44.range81-129.btcentralplus.com. [81.129.171.44]) by smtp.gmail.com with ESMTPSA id e2sm18477554wma.1.2016.01.18.06.30.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 18 Jan 2016 06:30:59 -0800 (PST) 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 1/3] clk: Allow clocks to be marked as CRITICAL Date: Mon, 18 Jan 2016 14:28:49 +0000 Message-Id: <1453127331-20616-2-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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- drivers/clk/clk.c | 7 ++++++- include/linux/clk-provider.h | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) -- 1.9.1 diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c index f13c3f4..835cb85 100644 --- a/drivers/clk/clk.c +++ b/drivers/clk/clk.c @@ -2576,8 +2576,13 @@ struct clk *clk_register(struct device *dev, struct clk_hw *hw) } ret = __clk_init(dev, hw->clk); - if (!ret) + if (!ret) { + if (core->flags & CLK_IS_CRITICAL) { + clk_core_prepare(core); + clk_core_enable(core); + } return hw->clk; + } __clk_free_clk(hw->clk); hw->clk = NULL; diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h index c56988a..ffa0b2e 100644 --- a/include/linux/clk-provider.h +++ b/include/linux/clk-provider.h @@ -31,6 +31,7 @@ #define CLK_SET_RATE_NO_REPARENT BIT(7) /* don't re-parent on rate change */ #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_IS_CRITICAL BIT(10) /* do not gate, ever */ struct clk; struct clk_hw;