Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp2283921ybe; Thu, 12 Sep 2019 07:18:36 -0700 (PDT) X-Google-Smtp-Source: APXvYqzxbdNNHQTYGhXB6eUu+EJzIgZaCq/31pB7/9AUxKGN1B+oUxr37rsg0tcsPE9rQyruPDn/ X-Received: by 2002:a50:fd96:: with SMTP id o22mr38186428edt.218.1568297916781; Thu, 12 Sep 2019 07:18:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568297916; cv=none; d=google.com; s=arc-20160816; b=IbRNprGS4m1O6j3TqBzTKmeS2ygEU+Sl8GVZcZAPuIc2GzaW/OyFBj8lwEnlHGMNIN yVsQf1GQD4VcWvzjENgxSe9g8whVHR36bqSnTXBn1d6mQKTi2ZffwQqkoyyPOYDa5z1V 26C7srrQm++kJcIrNz6X9pjlAiHsfKQDgVpri3Xz2i5rCI1DERmHgBZhXs9ti2pYT9Lh 3tVeDY+OahL1OQM3eim8oF1YtUzqdYK0I+5o4QH3lze72HrHGhcp+O0xBvQoP4HLl4oU bwim/V+8COWl+SMQTIbnz5WNHGkYP/0EwO89OW9pr3KCyWqLKarhNVp2GEG/bp0xHAWP 0VJg== 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=n4HuXOecJ8CldO3Qcv/+iPcaR05KtaOHoI08UvS2vkA=; b=YV/k0slHyIeRjitDzPYoPnwOpMe89Qa/zGEN5YEptxpMbMXpDRwjGEX6gdEkfsB4CK D4jT2bU+Wdu9pP+gH2fE+l1f+3LeRrImpEHL7ga2GSzwLW5Mh6XYHbYqwXCKWuRFZUpk tJwp2HOWCWQf3Bok6DnULoOg3Rd9Xii4c2aA+xu2tkaYIucwJ+jiC+LLHLT30xF4g5rV HKJLtByZV4ZLWCsT4eht4kzAx0dc9hyRM97kNqv2fCxMWQrJlXwum8adw0eB1Qj0q7mQ pbOYWaU6hNk+yTY4fqRDl71feASouqVKevYALdQe6+TpeRIGMrjdUM5prgrzyHZIiva0 DOVQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=P+ZBQtY8; 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 z55si14758080edz.254.2019.09.12.07.18.12; Thu, 12 Sep 2019 07:18:36 -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=P+ZBQtY8; 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 S1732590AbfILOPr (ORCPT + 99 others); Thu, 12 Sep 2019 10:15:47 -0400 Received: from mail-wr1-f67.google.com ([209.85.221.67]:41260 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732573AbfILOPp (ORCPT ); Thu, 12 Sep 2019 10:15:45 -0400 Received: by mail-wr1-f67.google.com with SMTP id h7so27642276wrw.8 for ; Thu, 12 Sep 2019 07:15:44 -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=n4HuXOecJ8CldO3Qcv/+iPcaR05KtaOHoI08UvS2vkA=; b=P+ZBQtY8IAzNGPcyXB0igxUncNFGMCWwMBp9abZV+Jm5F+30LQOPBeppdSvnj0ygqm hrS8LCbc8eJXsTvZ1EDprLEJhHN8zQchzIrOTywH921iwg+b8Zd57BPryK42xPtGP1tD BSxXYfkq4yxzMb3SqyYpz0yimALHuxtr1ZWK+fR02j/xCqh0L5dI9qxGNH2ydy39OEEY SJbI7PaGH2wanzx8FloCIpgmk+wTxnzV1+aJm0I9huFHiwf6m1NeO2rU+24OcbRrS9Bl vp6Q/plLCc2O6pf3mQj/LdU+bb/kXx4srClG/b8ynaDNK4EFzAaGX0eNWeUUKEG7wLJF oWWQ== 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=n4HuXOecJ8CldO3Qcv/+iPcaR05KtaOHoI08UvS2vkA=; b=E+7+7Tu71JLyxjv4eDF7o6EGcV3aT2+A8SfIznCZh9yUdCj2/qf6BvQpN/vEO1eSEb 0O4PEAdVju4cbzCnGPOGjj2NXIrJ3VFi3Ktsjc/ylZ0UWg99J+Td67KzVvQ9bTSGmoPx 4sNfJAjMXANCCM1GZri60qHWnWHfJ+AHBZGV2FPfsN4duLU+DPlFgFUs9WZvSYp+xuYt A/bVIOMlXoEwqIheuGNrEoAycBP55ykc0IkCC4Phvkjgezy3r4wsyLzh7oHBNg5GZMip Euum2iMpxl7EITuR7SAZZ8iJY5u3YXCUb7v580T6BAi34Mb4ASnNjScCPH7i9GLBCU1T g9RA== X-Gm-Message-State: APjAAAVbO9Ll6sJ14B3f/XYCF1E5iB9v17GJfAy6xQzEhpQEgHG8zW67 pwrgqAAW72jTA50q0hnLi47c8g== X-Received: by 2002:a05:6000:1101:: with SMTP id z1mr30889258wrw.332.1568297743762; Thu, 12 Sep 2019 07:15:43 -0700 (PDT) Received: from localhost.localdomain (69.red-83-35-113.dynamicip.rima-tde.net. [83.35.113.69]) by smtp.gmail.com with ESMTPSA id p23sm137599wma.18.2019.09.12.07.15.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 12 Sep 2019 07:15:43 -0700 (PDT) From: Jorge Ramirez-Ortiz To: jorge.ramirez-ortiz@linaro.org, sboyd@kernel.org, agross@kernel.org, mturquette@baylibre.com, bjorn.andersson@linaro.org Cc: niklas.cassel@linaro.org, linux-arm-msm@vger.kernel.org, linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 3/5] clk: qcom: hfpll: CLK_IGNORE_UNUSED Date: Thu, 12 Sep 2019 16:15:32 +0200 Message-Id: <20190912141534.28870-4-jorge.ramirez-ortiz@linaro.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190912141534.28870-1-jorge.ramirez-ortiz@linaro.org> References: <20190912141534.28870-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 e64c0fd82fe4..225c675f6779 100644 --- a/drivers/clk/qcom/hfpll.c +++ b/drivers/clk/qcom/hfpll.c @@ -56,6 +56,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, }; int ret; -- 2.23.0