From patchwork Wed Jul 31 20:29:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jorge Ramirez-Ortiz X-Patchwork-Id: 170231 Delivered-To: patch@linaro.org Received: by 2002:a92:512:0:0:0:0:0 with SMTP id q18csp4462599ile; Wed, 31 Jul 2019 13:29:53 -0700 (PDT) X-Google-Smtp-Source: APXvYqyL7AcVlvad9/aXpPeV882L8uyiXUu5Lot2Iqw9GtnWT9J3WgqnwgC/UDVydcW8RDLK/hWM X-Received: by 2002:a63:e62:: with SMTP id 34mr113975717pgo.331.1564604993381; Wed, 31 Jul 2019 13:29:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564604993; cv=none; d=google.com; s=arc-20160816; b=Bow7FCgfIGRB+eszl+rtdbFLY4w+i39R5AkVUrT94JHzHc7e+geNb1bKTHNDDADEKx maivxdz3QRP7Ix5VNYlF0HdLqMD2w0yxnHv95ekOlrMwKVf7whKCuSWdERzIrAtsFHGA 5uOLqdwGiojbSSq50Qf7RBl0DBi6+fGM8AzV9evwGwgFxRu4++OVuZLGm+eD4loaYjC6 gNQZxlyfWxRkBTt5PSwoyCri016ud8sl8rD+2wguk/FbOVg7kJD2bmXUG2FPJSAfRamk 7zlviwvd05iHKiUaQp03pQP7V9h3CjDlA8Ag9yUcaJ34x2k/ShraNXCpqls+abR15S0h kmRQ== 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=QDHb0MxyrDffiTT1c4asU3ET+aH1p1/6Fb93URE5McRNzlRnQlcWOR3N6usMdgLH9D Q9P+E/C6DLwmWGcW1dlr8EbnGLnChCOZCQ6kTQ6o0LHLdAhxuXmtlWjfgtWjhaY3SqbR u+nKswuci8QNtttSgse+eWXCqTjD8uPM24UIimRy93h4QvdakSgTpJicvadKSyr/FRzy YU9nxZazxhwGWpdwa/S316jPK68Oup+sBDvLe4Y0Sdxj3+g7GQPj2ImPNozusSme2DSi cR19v7G0BGLeAx+EHq8GeKjwhGlG2T602exYUZRsoBoCk3Eh2bqtzJ/XUNBwiJhX66iZ 70hg== 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-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-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 6si31916126pld.293.2019.07.31.13.29.53; Wed, 31 Jul 2019 13:29:53 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-arm-msm-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-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-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 S1728932AbfGaU3v (ORCPT + 16 others); Wed, 31 Jul 2019 16:29:51 -0400 Received: from mail-wm1-f66.google.com ([209.85.128.66]:37775 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730742AbfGaU3u (ORCPT ); Wed, 31 Jul 2019 16:29:50 -0400 Received: by mail-wm1-f66.google.com with SMTP id f17so60979471wme.2 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=YbtV1DrKRxKJcvY3nLQkV1NAloqL2RqJFQmegrmIoWfn5RSKFC1vyUONO9w0omrvRV sQ9s6zLnRJef1K4i0/wvF1nyulhUfGI3wiXva98NsjnSTGvKiBCoX/RZyWXgSLoPyZLj h3Iw6ZbahbY8qZAPAomAePosa5VLZJifkjP8c0mX7oV+broI1pjK5Wb0BGJ3C5A77OeX PerbM9w8sXAuZZRL1w8TMI0DRc3UYEigrlw8Y4SyWa0rkapWsxtrMj64kbEGOtwGM7LP DGTP/y6ko4UUFXStLIImY+e2Fpb3On5fSXpaI90Ri6cHiOx1rJpIL3BYcU6zISyZHn4Z LKZQ== X-Gm-Message-State: APjAAAWLny9qerXqUSmyJzuthSKa4cB/UavoMOysNmqFtsSqWerVcdJ0 ygwy/d7+uDa4ywys978kr+ttrw== 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 Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@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(+) -- 2.22.0 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);