From patchwork Thu Sep 12 14:15:32 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: 173716 Delivered-To: patch@linaro.org Received: by 2002:a05:6e02:ce:0:0:0:0 with SMTP id r14csp2191162ilq; Thu, 12 Sep 2019 07:16:00 -0700 (PDT) X-Google-Smtp-Source: APXvYqxHYy7HF5wAuyhyO7yfSPF8kfHqgjJI9Ihfp4fBPu6DCk/77roRE3/rEebWizFst6M4yXMV X-Received: by 2002:a50:f19c:: with SMTP id x28mr41490621edl.42.1568297760316; Thu, 12 Sep 2019 07:16:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568297760; cv=none; d=google.com; s=arc-20160816; b=jmKMThE7lR2FgKON+Ly+/5HQwZ+naLoiIAG4m/DdrP0aoYTlauoLSfPCT8iAN1hIGT Su+sTVbBi28+cLJoPTgz5fhz0ZQkjT+kyFuVSNyrkPMmXoz9O7IMB6Myhj9GooPoWKzf rBpqW/ZcukTxcrqJuScFspe5XZ2D/O+v7W0TbQLxNKN4xuHWEszzA4OQS9H0Cya0YpVS CACmxc0LXjGBl5CJuaXl1khIksu6TqeFfHzKL4c6YkMB83H7g920Ig0+Sd+OWD04FtGF Z82DggEf2Vd9YbHJPE3mLAgLd3WjVwcGEjwsY+msJ3IayEMwJ688LjE9IOVm7CVhk0lE f5gg== 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 s2si2060960edr.121.2019.09.12.07.16.00; Thu, 12 Sep 2019 07:16:00 -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 S1732594AbfILOPs (ORCPT + 27 others); Thu, 12 Sep 2019 10:15:48 -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 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(+) -- 2.23.0 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; From patchwork Thu Sep 12 14:15:33 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: 173714 Delivered-To: patch@linaro.org Received: by 2002:a05:6e02:ce:0:0:0:0 with SMTP id r14csp2191020ilq; Thu, 12 Sep 2019 07:15:54 -0700 (PDT) X-Google-Smtp-Source: APXvYqxMyeCQlZqJ2Tuo6PzSvQdSwC1AvvSBvUAxNq1GpKXGmtMTXcVvRclUsisb6gc9DXwJyRjf X-Received: by 2002:a50:c209:: with SMTP id n9mr42551204edf.215.1568297753897; Thu, 12 Sep 2019 07:15:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568297753; cv=none; d=google.com; s=arc-20160816; b=oSwAgjxmpt0Ix4m9ESJJx7XBpFqIMnICFHsep55Ln2X4HGVI/uO2C/G5TBp7k/RfrG jn85V0VYSMsJQ7MyFsc2ufo868oBq8nUmlfASsdPJgLuki/Tj0uccOHTDgViSXjqx6Y6 DeyDQ88Ws5MZoyyl7zdFLsIbiJb44YK3pknSE/oKafopZeM5jcFw38uu0FXMZJxgi1Yo bxoZYx7iOTcOJtrIbCH7Qf47DOpImuT1YTxPIIaYq0wYuo8anAJ0fzsZ7zvaQ+wGWNkB ihpkWBnQWhyLqqUoeeg6gqbD8ZaVSvve5e81mzPd2+G+G4+hO7l3brpKqFQcrozLtaxr OCNg== 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=kdN/u39fDQLfzd7rtHJ5JZYMbTkaxu/Gufv+LpTjgaQ=; b=x8UpckICCkP2JQEAl32Ry1eAjL0NZm+OI0SBpngWQgPmQHqFCakuO9aOZ3HiYJtVXr WG4w8j6sf+f6QB7rbwMZcekWNLEIHvHdzu6oQhL+gIoYpIyFvinja/bn0CU7C2tXF2+K rvloT6Gvd4Jb8fbYMnrnrQLNtjM5iEX0sgMOKa+6im01IB2ZdUMTK+4DUOP6dt87PG6u Lpb2auo4Ut6m4Qi8EdfrrhYR7E/LweeqYYBjdB4W7i5mp8ohsdg3ODgU9gDoAMGFIxXp tBELEr2LLX49VWybLkQgWcttBO5C1ndOyFvLLsbJLJ4nghtpViwebLFg/9f3gZvSpwsS EMzw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=A2GJVGuR; 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 e46si14674191eda.401.2019.09.12.07.15.53; Thu, 12 Sep 2019 07:15: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=A2GJVGuR; 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 S1732609AbfILOPu (ORCPT + 27 others); Thu, 12 Sep 2019 10:15:50 -0400 Received: from mail-wr1-f67.google.com ([209.85.221.67]:37158 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732480AbfILOPr (ORCPT ); Thu, 12 Sep 2019 10:15:47 -0400 Received: by mail-wr1-f67.google.com with SMTP id i1so28071167wro.4 for ; Thu, 12 Sep 2019 07:15:45 -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=kdN/u39fDQLfzd7rtHJ5JZYMbTkaxu/Gufv+LpTjgaQ=; b=A2GJVGuROuKBhePAYuM1kJnzZ+T14oTz0SyhSmH80VaUITfhegPebyeXbV6zE62Xfx +M2+4fBhZJiqH6grq1qnhtyv9iCXLAEJ3YvfzPvaucKSiPMCw3XxfbpdjR8Q2oGG7+mw 5R9RIDjiEly/GhYj2fbusH1rUkt5OJDOkzd7cCa6q2O/xAg7F6XKVlTumb8lyqTRP9E8 dJThiRkX/FmBDYymYDrK3hkiKYDhOB2nbqf0RTKWXmXRHZ6uoP2Ivhb3VTnRaeluPL5f KrgTDkK6zTN2LuuCR5cMrv5xKhvqmBhTWmW1kqolkHpJpTNakCw8x9uzqGVF6e7haIYV drdw== 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=kdN/u39fDQLfzd7rtHJ5JZYMbTkaxu/Gufv+LpTjgaQ=; b=BMAt1J8pDmo4zQ2GGasnonD6eoWUnffr4alQ80ha/IjtKWUh/pAZ9n1l0teaLvohsB 2qGpS4ANbzkBRuTP4cRo5jqiYAJd7nnDx+Bpv4mXvy4kSxtWHxTvZ99qgw80fw21eoT4 YnZYIGsnC8vzAIes2SEGmfrDVGCq+xGoA5dY1EXvHePiN1KbXhlg6T9hQmtYdDDXF4Rz 1MfVImWDOuEYvd4wPE7s2zRQb0N1N8CH4/obfB29VS9hOrgM2vzuHMnSyjXvaaetZbbD PhwUuf/ckHy4L5yo1A7A50s2yo4XFhoskTze5bPEd5+O/3vv8tjL+uig8jGy35VyhDHO Y3qQ== X-Gm-Message-State: APjAAAVV3L1TQKubeMnKUqSK5Ddj7rUotnyhMuV4dooPuoL/3L0lI6Ea ZXMBh7EpEChAVGO6bKIeeIvZcw== X-Received: by 2002:a5d:4d81:: with SMTP id b1mr37475923wru.27.1568297744791; Thu, 12 Sep 2019 07:15:44 -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.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 12 Sep 2019 07:15:44 -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 4/5] clk: qcom: hfpll: use clk_parent_data to specify the parent Date: Thu, 12 Sep 2019 16:15:33 +0200 Message-Id: <20190912141534.28870-5-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 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Extend support to platorms using different parents. Co-developed-by: Niklas Cassel Signed-off-by: Niklas Cassel Signed-off-by: Jorge Ramirez-Ortiz --- drivers/clk/qcom/hfpll.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) -- 2.23.0 diff --git a/drivers/clk/qcom/hfpll.c b/drivers/clk/qcom/hfpll.c index 225c675f6779..5ff7f5a60620 100644 --- a/drivers/clk/qcom/hfpll.c +++ b/drivers/clk/qcom/hfpll.c @@ -53,7 +53,6 @@ static int qcom_hfpll_probe(struct platform_device *pdev) struct regmap *regmap; struct clk_hfpll *h; struct clk_init_data init = { - .parent_names = (const char *[]){ "xo" }, .num_parents = 1, .ops = &clk_ops_hfpll, /* @@ -65,6 +64,7 @@ static int qcom_hfpll_probe(struct platform_device *pdev) .flags = CLK_IGNORE_UNUSED, }; int ret; + struct clk_parent_data pdata = { .index = 0 }; h = devm_kzalloc(dev, sizeof(*h), GFP_KERNEL); if (!h) @@ -83,6 +83,8 @@ static int qcom_hfpll_probe(struct platform_device *pdev) 0, &init.name)) return -ENODEV; + init.parent_data = &pdata; + h->d = &hdata; h->clkr.hw.init = &init; spin_lock_init(&h->lock);