Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp6408376ybi; Wed, 31 Jul 2019 13:54:54 -0700 (PDT) X-Google-Smtp-Source: APXvYqwxhbtZOwMT0pFvXVxqV4PpNl2rCf2mzBUYVu+eLbNDA8z5i8lfmbEOmc+KAYkIUSWbKmox X-Received: by 2002:a65:610a:: with SMTP id z10mr115919272pgu.178.1564606493894; Wed, 31 Jul 2019 13:54:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564606493; cv=none; d=google.com; s=arc-20160816; b=cCaUk+2zMnX9tcBduOs/+NpI+BQJ+ouxyukwTUC5HDvnfopKbZQ5+6XzH0h6tZF1I2 jiWCvJRfS+BqtYtPyL/XemQqyZ5Zc7lW5b9XWWt3OQdm5dstf6nkXys9V5Mpxb7AVVC1 jGey9K+EDmmwgioHS73uhSm2E9+ZV62jInQJzRi4HedXMTjHkpe+iErmRryMr6uKxQK2 fJ7u9ZVHL5K2oiLcrhfrg9f7S9mfRSTA3lt6y8b8hDjxtw+ka5/wMnQ4hO7JqL+ryEB4 dURb50yks6AgZED+adwzgZKDZ5vbb09L+CKgZhx4o9VFptVgdNWpKVzWKx0OBH7UqWg6 gP9w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=AduWeROQMDkKls+kl/fLswGL+rHZfEiqcyM0mR/LCMQ=; b=q3ZUvkYU7VMXlUFSYnb7cD7E4ZIyuqIDGARVRtDtBvMmNYre3SfJvvGUufl4+iI+I2 vp5FDu2tg5SfK4eGuxy/Lzdphd7D7pJZWAxDQ1g6OhnfxmGS8GMOU5VhgcRy5OrmRpWV 27MW5Jn4KJ4CxibF8bFBc0jUVVlA66PyAyCseqxzOJ5tIMZXcUoJpoJ9X47FjPq61wxc xb8F+lFNIdEpWG3sViFU7zE++X1tZNPB2bjEj30Prvmx/quvxrllNV9OonwGAVwPOPFb sczbIEiV/sKq2XlxrFAveHKCYrQwHFQdurRLpo7t1wfRosBYKhqo8MzR4xesK/eOjG0R YLwQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="k/M0HVfe"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t191si32006987pgd.370.2019.07.31.13.54.38; Wed, 31 Jul 2019 13:54:53 -0700 (PDT) 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; dkim=pass header.i=@linaro.org header.s=google header.b="k/M0HVfe"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729986AbfGaU3z (ORCPT + 99 others); Wed, 31 Jul 2019 16:29:55 -0400 Received: from mail-wm1-f66.google.com ([209.85.128.66]:34800 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730739AbfGaU3v (ORCPT ); Wed, 31 Jul 2019 16:29:51 -0400 Received: by mail-wm1-f66.google.com with SMTP id w9so2067436wmd.1 for ; Wed, 31 Jul 2019 13:29:50 -0700 (PDT) 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 :mime-version:content-transfer-encoding; bh=AduWeROQMDkKls+kl/fLswGL+rHZfEiqcyM0mR/LCMQ=; b=k/M0HVfeNBuPo+VT6LzsO154/layPjQ0BQjQ1FFLye6ZzLKSs9A3C1xWB1r1myjpdq VsGHmcwTky6N2aoUIcOBvHs3Dr0Hq+Df+PFt33LCiPqEU7s/m3/C4bW8Sdd0qYvdjyvL 6cX+bIGf0Nkuhy1V84m5xfa/Cqm+S9MwUgxShE72HrcBEuvo0tGCt/aw23hRAgtNwH7a zI2PhMl2zV9kX8z9UVzHuNDJlXQ5VjZaBkhKiqmUGqTCguZkYX/DmsRhFlRG6YrSUTnC bXz4oKCCe71Q2ifNJard7uAi+9PPyrbCFYcz+XmGnXz6htC3D0vHb6qNDUa6NJBINyiO r4Bg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=AduWeROQMDkKls+kl/fLswGL+rHZfEiqcyM0mR/LCMQ=; b=MtIAu2l3ZUJQgCPSmDz8ROp6huW1yGY+M/VWml1/EJVOxYp3SfV89diqRDZNTtKkul 1iZncMnqXG4QIaq6FKKUtNuul6s4ms3uRbBQA8mz5+qCNH3/18yhcJztldGCTNJJZDx/ 80TuVSaSm6PCBbp/WQIMsFIoHS8grPQ6yQT0nSD6CH0ytb4qkiHZk7mMlb8CTFWTxUio L0gzRDijOm09cVjUDR+DKEuBrGGth98kpywaskaiSqgolILEaQs2YiPZRX91ygML/BWA FfNVyr98jXV0p20UOdkQLzNT7jbDAgyeQ37wsuF8pmMEOQYl4uW1g7ZJsJpiFx0adyWu /upQ== X-Gm-Message-State: APjAAAWUAXFw8dZt6v4jUNDwE1KlAf7TCvYDMaNnlmG/SwbnX0XfTp1G eO3AzcVwAmny3ff4jekRAfwNBA== X-Received: by 2002:a1c:cb0a:: with SMTP id b10mr110875853wmg.41.1564604989405; Wed, 31 Jul 2019 13:29:49 -0700 (PDT) Received: from localhost.localdomain (19.red-176-86-136.dynamicip.rima-tde.net. [176.86.136.19]) by smtp.gmail.com with ESMTPSA id i18sm91905591wrp.91.2019.07.31.13.29.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 31 Jul 2019 13:29:48 -0700 (PDT) From: Jorge Ramirez-Ortiz To: jorge.ramirez-ortiz@linaro.org, bjorn.andersson@linaro.org, sboyd@kernel.org, david.brown@linaro.org, jassisinghbrar@gmail.com, mark.rutland@arm.com, mturquette@baylibre.com, robh+dt@kernel.org, will.deacon@arm.com, arnd@arndb.de, horms+renesas@verge.net.au, heiko@sntech.de, sibis@codeaurora.org, enric.balletbo@collabora.com, jagan@amarulasolutions.com, olof@lixom.net Cc: vkoul@kernel.org, niklas.cassel@linaro.org, georgi.djakov@linaro.org, amit.kucheria@linaro.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org, linux-arm-msm@vger.kernel.org, khasim.mohammed@linaro.org Subject: [PATCH v4 08/13] clk: qcom: hfpll: CLK_IGNORE_UNUSED Date: Wed, 31 Jul 2019 22:29:24 +0200 Message-Id: <20190731202929.16443-9-jorge.ramirez-ortiz@linaro.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190731202929.16443-1-jorge.ramirez-ortiz@linaro.org> References: <20190731202929.16443-1-jorge.ramirez-ortiz@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When COMMON_CLK_DISABLED_UNUSED is set, in an effort to save power and to keep the software model of the clock in line with reality, the framework transverses the clock tree and disables those clocks that were enabled by the firmware but have not been enabled by any device driver. If CPUFREQ is enabled, early during the system boot, it might attempt to change the CPU frequency ("set_rate"). If the HFPLL is selected as a provider, it will then change the rate for this clock. As boot continues, clk_disable_unused_subtree will run. Since it wont find a valid counter (enable_count) for a clock that is actually enabled it will attempt to disable it which will cause the CPU to stop. Notice that in this driver, calls to check whether the clock is enabled are routed via the is_enabled callback which queries the hardware. The following commit, rather than marking the clock critical and forcing the clock to be always enabled, addresses the above scenario making sure the clock is not disabled but it continues to rely on the firmware to enable the clock. Co-developed-by: Niklas Cassel Signed-off-by: Niklas Cassel Signed-off-by: Jorge Ramirez-Ortiz Reviewed-by: Bjorn Andersson --- drivers/clk/qcom/hfpll.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/clk/qcom/hfpll.c b/drivers/clk/qcom/hfpll.c index 0ffed0d41c50..d5fd27938e7b 100644 --- a/drivers/clk/qcom/hfpll.c +++ b/drivers/clk/qcom/hfpll.c @@ -58,6 +58,13 @@ static int qcom_hfpll_probe(struct platform_device *pdev) .parent_names = (const char *[]){ "xo" }, .num_parents = 1, .ops = &clk_ops_hfpll, + /* + * rather than marking the clock critical and forcing the clock + * to be always enabled, we make sure that the clock is not + * disabled: the firmware remains responsible of enabling this + * clock (for more info check the commit log) + */ + .flags = CLK_IGNORE_UNUSED, }; h = devm_kzalloc(dev, sizeof(*h), GFP_KERNEL); -- 2.22.0