linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Scott Wood <scottwood@freescale.com>
To: Mike Turquette <mturquette@linaro.org>,
	Tang Yuantian <Yuantian.Tang@freescale.com>
Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>,
	Liberman Igal-B31950 <Igal.Liberman@freescale.com>,
	Bucur Madalin-Cristian-B32716 <madalin.bucur@freescale.com>,
	<linux-clk@vger.kernel.org>, <linux-pm@vger.kernel.org>,
	<linuxppc-dev@lists.ozlabs.org>,
	<linux-arm-kernel@lists.infradead.org>,
	<devicetree@vger.kernel.org>,
	"Scott Wood" <scottwood@freescale.com>
Subject: [RFC PATCH 6/8] cpufreq: qoriq: Remove frequency masking and minimum
Date: Thu, 18 Jun 2015 21:49:16 -0500	[thread overview]
Message-ID: <1434682158-7243-7-git-send-email-scottwood@freescale.com> (raw)
In-Reply-To: <1434682158-7243-1-git-send-email-scottwood@freescale.com>

The clock driver now takes care of ensuring that the mux only
exposes options that are valid.  The driver was currently being overly
conservative in some cases -- for example, the "min_cpufreq =
get_bus_freq()" restriction only applies to chips with erratum
A-004510, and whether the freq_mask used on p5020 is needed depends on
the actual frequencies of the PLLs (FWIW, p5040 has a similar
limitation but its .freq_mask was zero).

Further, the freq_mask mechanism makes assumptions about the number and
order of the clock parents.  The new driver does not adhere to those
assumptions (in particular, it removes invalid options).

Signed-off-by: Scott Wood <scottwood@freescale.com>
---
 drivers/cpufreq/qoriq-cpufreq.c | 92 +----------------------------------------
 1 file changed, 2 insertions(+), 90 deletions(-)

diff --git a/drivers/cpufreq/qoriq-cpufreq.c b/drivers/cpufreq/qoriq-cpufreq.c
index 32ab99e..514395f 100644
--- a/drivers/cpufreq/qoriq-cpufreq.c
+++ b/drivers/cpufreq/qoriq-cpufreq.c
@@ -36,53 +36,6 @@ struct cpu_data {
 	struct cpufreq_frequency_table *table;
 };
 
-/**
- * struct soc_data - SoC specific data
- * @freq_mask: mask the disallowed frequencies
- * @flag: unique flags
- */
-struct soc_data {
-	u32 freq_mask[4];
-	u32 flag;
-};
-
-#define FREQ_MASK	1
-/* see hardware specification for the allowed frqeuencies */
-static const struct soc_data sdata[] = {
-	{ /* used by p2041 and p3041 */
-		.freq_mask = {0x8, 0x8, 0x2, 0x2},
-		.flag = FREQ_MASK,
-	},
-	{ /* used by p5020 */
-		.freq_mask = {0x8, 0x2},
-		.flag = FREQ_MASK,
-	},
-	{ /* used by p4080, p5040 */
-		.freq_mask = {0},
-		.flag = 0,
-	},
-};
-
-/*
- * the minimum allowed core frequency, in Hz
- * for chassis v1.0, >= platform frequency
- * for chassis v2.0, >= platform frequency / 2
- */
-static u32 min_cpufreq;
-static const u32 *fmask;
-
-#if defined(CONFIG_ARM)
-static int get_cpu_physical_id(int cpu)
-{
-	return topology_core_id(cpu);
-}
-#else
-static int get_cpu_physical_id(int cpu)
-{
-	return get_hard_smp_processor_id(cpu);
-}
-#endif
-
 static u32 get_bus_freq(void)
 {
 	struct device_node *soc;
@@ -195,7 +148,7 @@ static int qoriq_cpufreq_cpu_init(struct cpufreq_policy *policy)
 {
 	struct device_node *np, *pnode;
 	int i, count, ret;
-	u32 freq, mask;
+	u32 freq;
 	struct clk *clk;
 	struct cpufreq_frequency_table *table;
 	struct cpu_data *data;
@@ -230,23 +183,11 @@ static int qoriq_cpufreq_cpu_init(struct cpufreq_policy *policy)
 		goto err_pclk;
 	}
 
-	if (fmask)
-		mask = fmask[get_cpu_physical_id(cpu)];
-	else
-		mask = 0x0;
-
 	for (i = 0; i < count; i++) {
 		clk = clk_get_parent_by_index(policy->clk, i);
 		data->pclk[i] = clk;
 		freq = clk_get_rate(clk);
-		/*
-		 * the clock is valid if its frequency is not masked
-		 * and large than minimum allowed frequency.
-		 */
-		if (freq < min_cpufreq || (mask & (1 << i)))
-			table[i].frequency = CPUFREQ_ENTRY_INVALID;
-		else
-			table[i].frequency = freq / 1000;
+		table[i].frequency = freq / 1000;
 		table[i].driver_data = i;
 	}
 	freq_table_redup(table, count);
@@ -321,38 +262,9 @@ static struct cpufreq_driver qoriq_cpufreq_driver = {
 	.attr		= cpufreq_generic_attr,
 };
 
-static const struct of_device_id node_matches[] __initconst = {
-	{ .compatible = "fsl,p2041-clockgen", .data = &sdata[0], },
-	{ .compatible = "fsl,p3041-clockgen", .data = &sdata[0], },
-	{ .compatible = "fsl,p5020-clockgen", .data = &sdata[1], },
-	{ .compatible = "fsl,p4080-clockgen", .data = &sdata[2], },
-	{ .compatible = "fsl,p5040-clockgen", .data = &sdata[2], },
-	{ .compatible = "fsl,qoriq-clockgen-2.0", },
-	{}
-};
-
 static int __init qoriq_cpufreq_init(void)
 {
 	int ret;
-	struct device_node  *np;
-	const struct of_device_id *match;
-	const struct soc_data *data;
-
-	np = of_find_matching_node(NULL, node_matches);
-	if (!np)
-		return -ENODEV;
-
-	match = of_match_node(node_matches, np);
-	data = match->data;
-	if (data) {
-		if (data->flag)
-			fmask = data->freq_mask;
-		min_cpufreq = get_bus_freq();
-	} else {
-		min_cpufreq = get_bus_freq() / 2;
-	}
-
-	of_node_put(np);
 
 	ret = cpufreq_register_driver(&qoriq_cpufreq_driver);
 	if (!ret)
-- 
2.1.4

  parent reply	other threads:[~2015-06-19  2:49 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-19  2:49 [RFC PATCH 0/8] clk: qoriq: Move chip-specific knowledge into driver Scott Wood
2015-06-19  2:49 ` [RFC PATCH 1/8] ARM: dts: ls1021a: Fix clockgen node Scott Wood
2015-06-19  2:49 ` [RFC PATCH 2/8] cpufreq: qoriq: Don't look at clock implementation details Scott Wood
2015-06-19  2:49 ` [RFC PATCH 3/8] powerpc/fsl: Move fsl_guts.h out of arch/powerpc Scott Wood
2015-06-19  2:49 ` [RFC PATCH 4/8] clk: qoriq: Move chip-specific knowledge into driver Scott Wood
2015-06-19  2:49 ` [RFC PATCH 5/8] clk: qoriq: Redirect legacy clock nodes to new clocks Scott Wood
2015-06-19  2:49 ` Scott Wood [this message]
2015-06-19  2:49 ` [RFC PATCH 7/8] clk: qoriq: Expose OF clocks directly from the clockgen node Scott Wood
2015-06-19  2:49 ` [RFC PATCH 8/8] powerpc/fsl: Use new clockgen binding Scott Wood
2015-07-30 15:32   ` Liberman Igal
2015-08-11 18:25 ` [RFC PATCH 0/8] clk: qoriq: Move chip-specific knowledge into driver Michael Turquette
2015-08-15  6:43   ` Scott Wood
2015-10-02  0:23   ` Scott Wood
2015-10-02  0:26   ` Scott Wood
2015-10-09 23:57     ` Scott Wood
2015-10-22 10:11       ` Michael Turquette

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1434682158-7243-7-git-send-email-scottwood@freescale.com \
    --to=scottwood@freescale.com \
    --cc=Igal.Liberman@freescale.com \
    --cc=Yuantian.Tang@freescale.com \
    --cc=devicetree@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=madalin.bucur@freescale.com \
    --cc=mturquette@linaro.org \
    --cc=rjw@rjwysocki.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).