Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp2896433ybc; Mon, 25 Nov 2019 06:01:51 -0800 (PST) X-Google-Smtp-Source: APXvYqzppV5/0VaTAl5D4N9BQw/eN2Ttnv2i6xHI8i9U+B2wlgi7eu3B/duYrpkFw18usl7uX36E X-Received: by 2002:a17:906:1d41:: with SMTP id o1mr37857739ejh.333.1574690511304; Mon, 25 Nov 2019 06:01:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574690511; cv=none; d=google.com; s=arc-20160816; b=wQ0J07NvBN9FPtIco5NUw2y0x+MPjEHgUVfCD9CaZGcUNH2+UUvcD7dbtqQ7s6Oq1K gAI/phrbcEsAClx2CGQo6+nUqJfJq7Z8J9JqArRPokCKdsZld+LXlF+muBp29Zjae1EU VqRdKc9QqpE11UsvqLDUevWgyv8dz+UMlH64rPhj7H9yB/s60otTFr2y4K/FOtDt3f9n +nQQxn7CK7bv7rkVrEKaEQsn7Apg1K/EW7qsLf2BZlSTFnycJNls3eDy6tvy2AtAN8Il 4zHM7UDKRlr2ScMkMwPg+epcaAUd8CuF0DPjF3N09UmF0OvnDO2qJV63ImagRh5dBzb4 uF6g== 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=WZkXKWPlxV38+RGHoXYmkSG5VWJOb6ms6DI9j57Q8ak=; b=xjbtPzgA815KQK69l7uLCEbLSC1Rh9VlIBanIqd7hAnL8fuEuzY72USzU9E45zc/qY ABwJaCVSVjCxkTBY54T19ZZnWaCnd+IIkePxArVa1Mc3pX/LaOxAIdUxZBhSaGUfE0Mp +bIj9uDY0zAN9SKQoX3cNDApsD6CvjIP8lbx/jE9WAFbe5W+fm4nEqfP8xDUy3WrPA6I RU4+UzE1ttiR5ZlYBf3nrtwHxEkI1g7gbslfzl07HJzDcNsfG1VckE0oekQjBCpmYLnj gudtCUIRNOZ7M8GemntSZ7MGmwXt8vQ0IHjFNK049vB1Ukt8iSfcwttJPuueMjEunriF 2MiA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=VVW80aUa; 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 s20si4600678ejx.162.2019.11.25.06.01.16; Mon, 25 Nov 2019 06:01:51 -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; dkim=pass header.i=@linaro.org header.s=google header.b=VVW80aUa; 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 S1727930AbfKYN7h (ORCPT + 99 others); Mon, 25 Nov 2019 08:59:37 -0500 Received: from mail-lj1-f194.google.com ([209.85.208.194]:35591 "EHLO mail-lj1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727722AbfKYN7g (ORCPT ); Mon, 25 Nov 2019 08:59:36 -0500 Received: by mail-lj1-f194.google.com with SMTP id j6so6959865lja.2 for ; Mon, 25 Nov 2019 05:59:34 -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 :mime-version:content-transfer-encoding; bh=WZkXKWPlxV38+RGHoXYmkSG5VWJOb6ms6DI9j57Q8ak=; b=VVW80aUaA6CDpUPPAiJcUsgChOZb4zTH0QwFYFtR7JP+HUKkuPJ+i9XWLXyhyQVr50 AWdwJCtNYXP26uSH5xqPCKA769xOd4tpgEP7RC+Y+aDCtOALI8Gy5Ert/WtaDJkTBXmE ezomzfwvrwM6f761uHxxpEbTxUVd3gNfpLKN6N62wxJrPGGSwne7XIZTga8QNCHC/tQc 9h0HyfzZimccS4kViSljdHy/VnqV6TvXAkwYbDDD7U9GqOZ8IRxnVLx1Ku//fVs1tbRR M+8UCF0XyoGB1sYLNH18gnEXmgTTwYQ0nySr2W0IHkcRyrh2+NsailaBHpPcCEkfAQZq M7hg== 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=WZkXKWPlxV38+RGHoXYmkSG5VWJOb6ms6DI9j57Q8ak=; b=Idci9UDZlu8DyT/OgIfX9qlJVsn0dLOtzhB1QlWmtp3y3FZGeSu+ENn/SLs3CqY4/y x+xf+00Jpu2asAMqRaZ+PO1DTWwzezv1+t0hBTpmkNdyMtHxCEbgppOFP3W090JRAdRu lZqsUuZdtxLl83nMywQrZIuv7OoG2oiAr7S19OcEm01qudlykF55vRORO3HikQ5uZwLR +c5TwuoeZAsH0gLVF8UAOzOnmR3khb7Syqw7IxqG1Q8xoYVlJ3E68wMf7QIXbsS9v06b BZstSmZSFKCM9pZ9zEaEWHV0JZ3glyA6TagloTM8oLNtZoXwjOi8gj/YS3C1Gaogkq+5 mUHg== X-Gm-Message-State: APjAAAUJtnNWLw8RH6jzmN4I6LWYnPGuLkovgnxI8fbh3+WxsoCUykRp zDIAl1Zh3eFFFoNWZ3554tuSuQ== X-Received: by 2002:a2e:844e:: with SMTP id u14mr9142325ljh.17.1574690373313; Mon, 25 Nov 2019 05:59:33 -0800 (PST) Received: from centauri.lan (ua-84-217-220-205.bbcust.telenor.se. [84.217.220.205]) by smtp.gmail.com with ESMTPSA id s23sm4041871ljm.20.2019.11.25.05.59.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Nov 2019 05:59:32 -0800 (PST) From: Niklas Cassel To: Andy Gross , Bjorn Andersson Cc: linux-arm-msm@vger.kernel.org, amit.kucheria@linaro.org, sboyd@kernel.org, Jorge Ramirez-Ortiz , Niklas Cassel , Michael Turquette , linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 4/7] clk: qcom: hfpll: CLK_IGNORE_UNUSED Date: Mon, 25 Nov 2019 14:59:06 +0100 Message-Id: <20191125135910.679310-5-niklas.cassel@linaro.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191125135910.679310-1-niklas.cassel@linaro.org> References: <20191125135910.679310-1-niklas.cassel@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 From: Jorge Ramirez-Ortiz 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 --- Changes since v2: -None 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