All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/4] Switch Ux500 to use generic DT cpufreq
@ 2017-08-10 12:52 ` Linus Walleij
  0 siblings, 0 replies; 26+ messages in thread
From: Linus Walleij @ 2017-08-10 12:52 UTC (permalink / raw)
  To: Rafael J . Wysocki, Viresh Kumar, Lee Jones
  Cc: linux-pm, linux-arm-kernel, Arnd Bergmann, Ulf Hansson, Linus Walleij

This series switches the Ux500 over to use the generic DT cpufreq.
A pretty nice cleanup.

Merge plan:

- Merge patch 1/4 into ARM SoC DTS branches separately.

- Merge the remaining three patches into the cpufreq tree
  with Lee's ACK on the second (MFD) patch.

This should make for a clean transition for v4.14.

Linus Walleij (4):
  ARM: dts: augment Ux500 to use DT cpufreq
  cpufreq: enable the DT cpufreq driver on the Ux500
  mfd: db8500-prcmu: Get rid of cpufreq dependency
  cpufreq: dbx500: Delete obsolete driver

 arch/arm/boot/dts/ste-dbx5x0.dtsi    |  15 ++---
 arch/arm/mach-ux500/Kconfig          |   1 +
 drivers/cpufreq/Kconfig.arm          |   9 ---
 drivers/cpufreq/Makefile             |   1 -
 drivers/cpufreq/cpufreq-dt-platdev.c |   5 ++
 drivers/cpufreq/dbx500-cpufreq.c     | 103 -----------------------------------
 drivers/mfd/db8500-prcmu.c           |  59 ++++++--------------
 7 files changed, 31 insertions(+), 162 deletions(-)
 delete mode 100644 drivers/cpufreq/dbx500-cpufreq.c

-- 
2.9.4

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [PATCH 0/4] Switch Ux500 to use generic DT cpufreq
@ 2017-08-10 12:52 ` Linus Walleij
  0 siblings, 0 replies; 26+ messages in thread
From: Linus Walleij @ 2017-08-10 12:52 UTC (permalink / raw)
  To: linux-arm-kernel

This series switches the Ux500 over to use the generic DT cpufreq.
A pretty nice cleanup.

Merge plan:

- Merge patch 1/4 into ARM SoC DTS branches separately.

- Merge the remaining three patches into the cpufreq tree
  with Lee's ACK on the second (MFD) patch.

This should make for a clean transition for v4.14.

Linus Walleij (4):
  ARM: dts: augment Ux500 to use DT cpufreq
  cpufreq: enable the DT cpufreq driver on the Ux500
  mfd: db8500-prcmu: Get rid of cpufreq dependency
  cpufreq: dbx500: Delete obsolete driver

 arch/arm/boot/dts/ste-dbx5x0.dtsi    |  15 ++---
 arch/arm/mach-ux500/Kconfig          |   1 +
 drivers/cpufreq/Kconfig.arm          |   9 ---
 drivers/cpufreq/Makefile             |   1 -
 drivers/cpufreq/cpufreq-dt-platdev.c |   5 ++
 drivers/cpufreq/dbx500-cpufreq.c     | 103 -----------------------------------
 drivers/mfd/db8500-prcmu.c           |  59 ++++++--------------
 7 files changed, 31 insertions(+), 162 deletions(-)
 delete mode 100644 drivers/cpufreq/dbx500-cpufreq.c

-- 
2.9.4

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [PATCH 1/4] ARM: dts: augment Ux500 to use DT cpufreq
  2017-08-10 12:52 ` Linus Walleij
@ 2017-08-10 12:52   ` Linus Walleij
  -1 siblings, 0 replies; 26+ messages in thread
From: Linus Walleij @ 2017-08-10 12:52 UTC (permalink / raw)
  To: Rafael J . Wysocki, Viresh Kumar, Lee Jones
  Cc: linux-pm, linux-arm-kernel, Arnd Bergmann, Ulf Hansson, Linus Walleij

This adds the operating points to the Ux500 device tree and
deletes the old special-purpose cpufreq node, as we can now
use the generic DT cpufreq driver.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
Viresh et al: I will merge this into ARM SoC separately from
the rest of the patches once we agree on this approach.
---
 arch/arm/boot/dts/ste-dbx5x0.dtsi | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/arch/arm/boot/dts/ste-dbx5x0.dtsi b/arch/arm/boot/dts/ste-dbx5x0.dtsi
index 6c5affe2d0f5..2310a4e97768 100644
--- a/arch/arm/boot/dts/ste-dbx5x0.dtsi
+++ b/arch/arm/boot/dts/ste-dbx5x0.dtsi
@@ -37,6 +37,14 @@
 			device_type = "cpu";
 			compatible = "arm,cortex-a9";
 			reg = <0x300>;
+			/* cpufreq controls */
+			operating-points = <998400 0
+					    800000 0
+					    400000 0
+					    200000 0>;
+			clocks = <&prcmu_clk PRCMU_ARMSS>;
+			clock-names = "cpu";
+			clock-latency = <20000>;
 		};
 		CPU1: cpu@301 {
 			device_type = "cpu";
@@ -494,13 +502,6 @@
 				reg = <0x80157450 0xC>;
 			};
 
-			cpufreq {
-				compatible = "stericsson,cpufreq-ux500";
-				clocks = <&prcmu_clk PRCMU_ARMSS>;
-				clock-names = "armss";
-				status = "disabled";
-			};
-
 			thermal@801573c0 {
 				compatible = "stericsson,db8500-thermal";
 				reg = <0x801573c0 0x40>;
-- 
2.9.4

^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCH 1/4] ARM: dts: augment Ux500 to use DT cpufreq
@ 2017-08-10 12:52   ` Linus Walleij
  0 siblings, 0 replies; 26+ messages in thread
From: Linus Walleij @ 2017-08-10 12:52 UTC (permalink / raw)
  To: linux-arm-kernel

This adds the operating points to the Ux500 device tree and
deletes the old special-purpose cpufreq node, as we can now
use the generic DT cpufreq driver.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
Viresh et al: I will merge this into ARM SoC separately from
the rest of the patches once we agree on this approach.
---
 arch/arm/boot/dts/ste-dbx5x0.dtsi | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/arch/arm/boot/dts/ste-dbx5x0.dtsi b/arch/arm/boot/dts/ste-dbx5x0.dtsi
index 6c5affe2d0f5..2310a4e97768 100644
--- a/arch/arm/boot/dts/ste-dbx5x0.dtsi
+++ b/arch/arm/boot/dts/ste-dbx5x0.dtsi
@@ -37,6 +37,14 @@
 			device_type = "cpu";
 			compatible = "arm,cortex-a9";
 			reg = <0x300>;
+			/* cpufreq controls */
+			operating-points = <998400 0
+					    800000 0
+					    400000 0
+					    200000 0>;
+			clocks = <&prcmu_clk PRCMU_ARMSS>;
+			clock-names = "cpu";
+			clock-latency = <20000>;
 		};
 		CPU1: cpu at 301 {
 			device_type = "cpu";
@@ -494,13 +502,6 @@
 				reg = <0x80157450 0xC>;
 			};
 
-			cpufreq {
-				compatible = "stericsson,cpufreq-ux500";
-				clocks = <&prcmu_clk PRCMU_ARMSS>;
-				clock-names = "armss";
-				status = "disabled";
-			};
-
 			thermal at 801573c0 {
 				compatible = "stericsson,db8500-thermal";
 				reg = <0x801573c0 0x40>;
-- 
2.9.4

^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCH 2/4] cpufreq: enable the DT cpufreq driver on the Ux500
  2017-08-10 12:52 ` Linus Walleij
@ 2017-08-10 12:52   ` Linus Walleij
  -1 siblings, 0 replies; 26+ messages in thread
From: Linus Walleij @ 2017-08-10 12:52 UTC (permalink / raw)
  To: Rafael J . Wysocki, Viresh Kumar, Lee Jones
  Cc: linux-pm, linux-arm-kernel, Arnd Bergmann, Ulf Hansson, Linus Walleij

This enables the generic DT and OPP-based cpufreq driver on the
ST-Ericsson Ux500 series.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
 drivers/cpufreq/cpufreq-dt-platdev.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/cpufreq/cpufreq-dt-platdev.c b/drivers/cpufreq/cpufreq-dt-platdev.c
index 1c262923fe58..d80300251bc4 100644
--- a/drivers/cpufreq/cpufreq-dt-platdev.c
+++ b/drivers/cpufreq/cpufreq-dt-platdev.c
@@ -88,6 +88,11 @@ static const struct of_device_id machines[] __initconst = {
 	{ .compatible = "socionext,uniphier-ld11", },
 	{ .compatible = "socionext,uniphier-ld20", },
 
+	{ .compatible = "st-ericsson,u8500", },
+	{ .compatible = "st-ericsson,u8540", },
+	{ .compatible = "st-ericsson,u9500", },
+	{ .compatible = "st-ericsson,u9540", },
+
 	{ .compatible = "ti,omap2", },
 	{ .compatible = "ti,omap3", },
 	{ .compatible = "ti,omap4", },
-- 
2.9.4

^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCH 2/4] cpufreq: enable the DT cpufreq driver on the Ux500
@ 2017-08-10 12:52   ` Linus Walleij
  0 siblings, 0 replies; 26+ messages in thread
From: Linus Walleij @ 2017-08-10 12:52 UTC (permalink / raw)
  To: linux-arm-kernel

This enables the generic DT and OPP-based cpufreq driver on the
ST-Ericsson Ux500 series.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
 drivers/cpufreq/cpufreq-dt-platdev.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/cpufreq/cpufreq-dt-platdev.c b/drivers/cpufreq/cpufreq-dt-platdev.c
index 1c262923fe58..d80300251bc4 100644
--- a/drivers/cpufreq/cpufreq-dt-platdev.c
+++ b/drivers/cpufreq/cpufreq-dt-platdev.c
@@ -88,6 +88,11 @@ static const struct of_device_id machines[] __initconst = {
 	{ .compatible = "socionext,uniphier-ld11", },
 	{ .compatible = "socionext,uniphier-ld20", },
 
+	{ .compatible = "st-ericsson,u8500", },
+	{ .compatible = "st-ericsson,u8540", },
+	{ .compatible = "st-ericsson,u9500", },
+	{ .compatible = "st-ericsson,u9540", },
+
 	{ .compatible = "ti,omap2", },
 	{ .compatible = "ti,omap3", },
 	{ .compatible = "ti,omap4", },
-- 
2.9.4

^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCH 3/4] mfd: db8500-prcmu: Get rid of cpufreq dependency
  2017-08-10 12:52 ` Linus Walleij
@ 2017-08-10 12:52   ` Linus Walleij
  -1 siblings, 0 replies; 26+ messages in thread
From: Linus Walleij @ 2017-08-10 12:52 UTC (permalink / raw)
  To: Rafael J . Wysocki, Viresh Kumar, Lee Jones
  Cc: linux-pm, linux-arm-kernel, Arnd Bergmann, Ulf Hansson, Linus Walleij

The ARMSS clock, also known as the operating point of the
CPU, should not cross-depend on cpufreq like this. Move
the code to use just frequencies and remove the false
frequency (1GHz) and put in the actual frequency provided
by the ARMSS clock (998400000 Hz) as part of the process.

After this and the related cpufreq patch, the DB8500 will
simply use the standard DT cpufreq driver to change the
operating points through the common clock framework using
the ARMSS clock.

Cc: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
Lee, this needs to be merged together with the other
related cpufreq patches, so an ACK to take this through
the cpufreq subsystem would be appreciated once you're
pleased with it.
---
 drivers/mfd/db8500-prcmu.c | 59 +++++++++++++---------------------------------
 1 file changed, 17 insertions(+), 42 deletions(-)

diff --git a/drivers/mfd/db8500-prcmu.c b/drivers/mfd/db8500-prcmu.c
index 5c739ac752e8..a66be0203ece 100644
--- a/drivers/mfd/db8500-prcmu.c
+++ b/drivers/mfd/db8500-prcmu.c
@@ -33,7 +33,6 @@
 #include <linux/mfd/abx500/ab8500.h>
 #include <linux/regulator/db8500-prcmu.h>
 #include <linux/regulator/machine.h>
-#include <linux/cpufreq.h>
 #include <linux/platform_data/ux500_wdt.h>
 #include <linux/platform_data/db8500_thermal.h>
 #include "dbx500-prcmu-regs.h"
@@ -1692,32 +1691,22 @@ static long round_clock_rate(u8 clock, unsigned long rate)
 	return rounded_rate;
 }
 
-/* CPU FREQ table, may be changed due to if MAX_OPP is supported. */
-static struct cpufreq_frequency_table db8500_cpufreq_table[] = {
-	{ .frequency = 200000, .driver_data = ARM_EXTCLK,},
-	{ .frequency = 400000, .driver_data = ARM_50_OPP,},
-	{ .frequency = 800000, .driver_data = ARM_100_OPP,},
-	{ .frequency = CPUFREQ_TABLE_END,}, /* To be used for MAX_OPP. */
-	{ .frequency = CPUFREQ_TABLE_END,},
-};
+static const unsigned long armss_freqs[] = { 200000000, 400000000, 800000000, 998400000 };
 
 static long round_armss_rate(unsigned long rate)
 {
-	struct cpufreq_frequency_table *pos;
-	long freq = 0;
-
-	/* cpufreq table frequencies is in KHz. */
-	rate = rate / 1000;
+	unsigned long freq = 0;
+	int i;
 
 	/* Find the corresponding arm opp from the cpufreq table. */
-	cpufreq_for_each_entry(pos, db8500_cpufreq_table) {
-		freq = pos->frequency;
-		if (freq == rate)
+	for (i = 0; i < ARRAY_SIZE(armss_freqs); i++) {
+		freq = armss_freqs[i];
+		if (rate <= freq)
 			break;
 	}
 
 	/* Return the last valid value, even if a match was not found. */
-	return freq * 1000;
+	return freq;
 }
 
 #define MIN_PLL_VCO_RATE 600000000ULL
@@ -1854,21 +1843,23 @@ static void set_clock_rate(u8 clock, unsigned long rate)
 
 static int set_armss_rate(unsigned long rate)
 {
-	struct cpufreq_frequency_table *pos;
-
-	/* cpufreq table frequencies is in KHz. */
-	rate = rate / 1000;
+	unsigned long freq;
+	u8 opps[] = { ARM_EXTCLK, ARM_50_OPP, ARM_100_OPP, ARM_MAX_OPP };
+	int i;
 
 	/* Find the corresponding arm opp from the cpufreq table. */
-	cpufreq_for_each_entry(pos, db8500_cpufreq_table)
-		if (pos->frequency == rate)
+	for (i = 0; i < ARRAY_SIZE(armss_freqs); i++) {
+		freq = armss_freqs[i];
+		if (rate == freq)
 			break;
+	}
 
-	if (pos->frequency != rate)
+	if (rate != freq)
 		return -EINVAL;
 
 	/* Set the new arm opp. */
-	return db8500_prcmu_set_arm_opp(pos->driver_data);
+	pr_debug("SET ARM OPP 0x%02x\n", opps[i]);
+	return db8500_prcmu_set_arm_opp(opps[i]);
 }
 
 static int set_plldsi_rate(unsigned long rate)
@@ -3049,12 +3040,6 @@ static const struct mfd_cell db8500_prcmu_devs[] = {
 		.pdata_size = sizeof(db8500_regulators),
 	},
 	{
-		.name = "cpufreq-ux500",
-		.of_compatible = "stericsson,cpufreq-ux500",
-		.platform_data = &db8500_cpufreq_table,
-		.pdata_size = sizeof(db8500_cpufreq_table),
-	},
-	{
 		.name = "cpuidle-dbx500",
 		.of_compatible = "stericsson,cpuidle-dbx500",
 	},
@@ -3067,14 +3052,6 @@ static const struct mfd_cell db8500_prcmu_devs[] = {
 	},
 };
 
-static void db8500_prcmu_update_cpufreq(void)
-{
-	if (prcmu_has_arm_maxopp()) {
-		db8500_cpufreq_table[3].frequency = 1000000;
-		db8500_cpufreq_table[3].driver_data = ARM_MAX_OPP;
-	}
-}
-
 static int db8500_prcmu_register_ab8500(struct device *parent)
 {
 	struct device_node *np;
@@ -3160,8 +3137,6 @@ static int db8500_prcmu_probe(struct platform_device *pdev)
 
 	prcmu_config_esram0_deep_sleep(ESRAM0_DEEP_SLEEP_STATE_RET);
 
-	db8500_prcmu_update_cpufreq();
-
 	err = mfd_add_devices(&pdev->dev, 0, common_prcmu_devs,
 			      ARRAY_SIZE(common_prcmu_devs), NULL, 0, db8500_irq_domain);
 	if (err) {
-- 
2.9.4

^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCH 3/4] mfd: db8500-prcmu: Get rid of cpufreq dependency
@ 2017-08-10 12:52   ` Linus Walleij
  0 siblings, 0 replies; 26+ messages in thread
From: Linus Walleij @ 2017-08-10 12:52 UTC (permalink / raw)
  To: linux-arm-kernel

The ARMSS clock, also known as the operating point of the
CPU, should not cross-depend on cpufreq like this. Move
the code to use just frequencies and remove the false
frequency (1GHz) and put in the actual frequency provided
by the ARMSS clock (998400000 Hz) as part of the process.

After this and the related cpufreq patch, the DB8500 will
simply use the standard DT cpufreq driver to change the
operating points through the common clock framework using
the ARMSS clock.

Cc: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
Lee, this needs to be merged together with the other
related cpufreq patches, so an ACK to take this through
the cpufreq subsystem would be appreciated once you're
pleased with it.
---
 drivers/mfd/db8500-prcmu.c | 59 +++++++++++++---------------------------------
 1 file changed, 17 insertions(+), 42 deletions(-)

diff --git a/drivers/mfd/db8500-prcmu.c b/drivers/mfd/db8500-prcmu.c
index 5c739ac752e8..a66be0203ece 100644
--- a/drivers/mfd/db8500-prcmu.c
+++ b/drivers/mfd/db8500-prcmu.c
@@ -33,7 +33,6 @@
 #include <linux/mfd/abx500/ab8500.h>
 #include <linux/regulator/db8500-prcmu.h>
 #include <linux/regulator/machine.h>
-#include <linux/cpufreq.h>
 #include <linux/platform_data/ux500_wdt.h>
 #include <linux/platform_data/db8500_thermal.h>
 #include "dbx500-prcmu-regs.h"
@@ -1692,32 +1691,22 @@ static long round_clock_rate(u8 clock, unsigned long rate)
 	return rounded_rate;
 }
 
-/* CPU FREQ table, may be changed due to if MAX_OPP is supported. */
-static struct cpufreq_frequency_table db8500_cpufreq_table[] = {
-	{ .frequency = 200000, .driver_data = ARM_EXTCLK,},
-	{ .frequency = 400000, .driver_data = ARM_50_OPP,},
-	{ .frequency = 800000, .driver_data = ARM_100_OPP,},
-	{ .frequency = CPUFREQ_TABLE_END,}, /* To be used for MAX_OPP. */
-	{ .frequency = CPUFREQ_TABLE_END,},
-};
+static const unsigned long armss_freqs[] = { 200000000, 400000000, 800000000, 998400000 };
 
 static long round_armss_rate(unsigned long rate)
 {
-	struct cpufreq_frequency_table *pos;
-	long freq = 0;
-
-	/* cpufreq table frequencies is in KHz. */
-	rate = rate / 1000;
+	unsigned long freq = 0;
+	int i;
 
 	/* Find the corresponding arm opp from the cpufreq table. */
-	cpufreq_for_each_entry(pos, db8500_cpufreq_table) {
-		freq = pos->frequency;
-		if (freq == rate)
+	for (i = 0; i < ARRAY_SIZE(armss_freqs); i++) {
+		freq = armss_freqs[i];
+		if (rate <= freq)
 			break;
 	}
 
 	/* Return the last valid value, even if a match was not found. */
-	return freq * 1000;
+	return freq;
 }
 
 #define MIN_PLL_VCO_RATE 600000000ULL
@@ -1854,21 +1843,23 @@ static void set_clock_rate(u8 clock, unsigned long rate)
 
 static int set_armss_rate(unsigned long rate)
 {
-	struct cpufreq_frequency_table *pos;
-
-	/* cpufreq table frequencies is in KHz. */
-	rate = rate / 1000;
+	unsigned long freq;
+	u8 opps[] = { ARM_EXTCLK, ARM_50_OPP, ARM_100_OPP, ARM_MAX_OPP };
+	int i;
 
 	/* Find the corresponding arm opp from the cpufreq table. */
-	cpufreq_for_each_entry(pos, db8500_cpufreq_table)
-		if (pos->frequency == rate)
+	for (i = 0; i < ARRAY_SIZE(armss_freqs); i++) {
+		freq = armss_freqs[i];
+		if (rate == freq)
 			break;
+	}
 
-	if (pos->frequency != rate)
+	if (rate != freq)
 		return -EINVAL;
 
 	/* Set the new arm opp. */
-	return db8500_prcmu_set_arm_opp(pos->driver_data);
+	pr_debug("SET ARM OPP 0x%02x\n", opps[i]);
+	return db8500_prcmu_set_arm_opp(opps[i]);
 }
 
 static int set_plldsi_rate(unsigned long rate)
@@ -3049,12 +3040,6 @@ static const struct mfd_cell db8500_prcmu_devs[] = {
 		.pdata_size = sizeof(db8500_regulators),
 	},
 	{
-		.name = "cpufreq-ux500",
-		.of_compatible = "stericsson,cpufreq-ux500",
-		.platform_data = &db8500_cpufreq_table,
-		.pdata_size = sizeof(db8500_cpufreq_table),
-	},
-	{
 		.name = "cpuidle-dbx500",
 		.of_compatible = "stericsson,cpuidle-dbx500",
 	},
@@ -3067,14 +3052,6 @@ static const struct mfd_cell db8500_prcmu_devs[] = {
 	},
 };
 
-static void db8500_prcmu_update_cpufreq(void)
-{
-	if (prcmu_has_arm_maxopp()) {
-		db8500_cpufreq_table[3].frequency = 1000000;
-		db8500_cpufreq_table[3].driver_data = ARM_MAX_OPP;
-	}
-}
-
 static int db8500_prcmu_register_ab8500(struct device *parent)
 {
 	struct device_node *np;
@@ -3160,8 +3137,6 @@ static int db8500_prcmu_probe(struct platform_device *pdev)
 
 	prcmu_config_esram0_deep_sleep(ESRAM0_DEEP_SLEEP_STATE_RET);
 
-	db8500_prcmu_update_cpufreq();
-
 	err = mfd_add_devices(&pdev->dev, 0, common_prcmu_devs,
 			      ARRAY_SIZE(common_prcmu_devs), NULL, 0, db8500_irq_domain);
 	if (err) {
-- 
2.9.4

^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCH 4/4] cpufreq: dbx500: Delete obsolete driver
  2017-08-10 12:52 ` Linus Walleij
@ 2017-08-10 12:52   ` Linus Walleij
  -1 siblings, 0 replies; 26+ messages in thread
From: Linus Walleij @ 2017-08-10 12:52 UTC (permalink / raw)
  To: Rafael J . Wysocki, Viresh Kumar, Lee Jones
  Cc: linux-pm, linux-arm-kernel, Arnd Bergmann, Ulf Hansson, Linus Walleij

We have moved the Ux500 over to use the generic DT based
cpufreq driver, so delete the old custom driver.

At the same time select CPUFREQ_DT from the machine's
Kconfig in order to satisfy the "default ARCH_U8500"
selection on the old driver.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
 arch/arm/mach-ux500/Kconfig      |   1 +
 drivers/cpufreq/Kconfig.arm      |   9 ----
 drivers/cpufreq/Makefile         |   1 -
 drivers/cpufreq/dbx500-cpufreq.c | 103 ---------------------------------------
 4 files changed, 1 insertion(+), 113 deletions(-)
 delete mode 100644 drivers/cpufreq/dbx500-cpufreq.c

diff --git a/arch/arm/mach-ux500/Kconfig b/arch/arm/mach-ux500/Kconfig
index 4740ac393297..2b56e4af5a27 100644
--- a/arch/arm/mach-ux500/Kconfig
+++ b/arch/arm/mach-ux500/Kconfig
@@ -9,6 +9,7 @@ menuconfig ARCH_U8500
 	select ARM_GIC
 	select CACHE_L2X0
 	select CLKSRC_NOMADIK_MTU
+	select CPUFREQ_DT
 	select GPIOLIB
 	select HAVE_ARM_SCU if SMP
 	select HAVE_ARM_TWD if SMP
diff --git a/drivers/cpufreq/Kconfig.arm b/drivers/cpufreq/Kconfig.arm
index 2011fec2d6ad..74ed7e9a7f27 100644
--- a/drivers/cpufreq/Kconfig.arm
+++ b/drivers/cpufreq/Kconfig.arm
@@ -71,15 +71,6 @@ config ARM_HIGHBANK_CPUFREQ
 
 	  If in doubt, say N.
 
-config ARM_DB8500_CPUFREQ
-	tristate "ST-Ericsson DB8500 cpufreq" if COMPILE_TEST && !ARCH_U8500
-	default ARCH_U8500
-	depends on HAS_IOMEM
-	depends on !CPU_THERMAL || THERMAL
-	help
-	  This adds the CPUFreq driver for ST-Ericsson Ux500 (DB8500) SoC
-	  series.
-
 config ARM_IMX6Q_CPUFREQ
 	tristate "Freescale i.MX6 cpufreq support"
 	depends on ARCH_MXC
diff --git a/drivers/cpufreq/Makefile b/drivers/cpufreq/Makefile
index ab3a42cd29ef..a07c6efe4910 100644
--- a/drivers/cpufreq/Makefile
+++ b/drivers/cpufreq/Makefile
@@ -53,7 +53,6 @@ obj-$(CONFIG_ARM_DT_BL_CPUFREQ)		+= arm_big_little_dt.o
 
 obj-$(CONFIG_ARM_BRCMSTB_AVS_CPUFREQ)	+= brcmstb-avs-cpufreq.o
 obj-$(CONFIG_ARCH_DAVINCI)		+= davinci-cpufreq.o
-obj-$(CONFIG_ARM_DB8500_CPUFREQ)	+= dbx500-cpufreq.o
 obj-$(CONFIG_ARM_EXYNOS5440_CPUFREQ)	+= exynos5440-cpufreq.o
 obj-$(CONFIG_ARM_HIGHBANK_CPUFREQ)	+= highbank-cpufreq.o
 obj-$(CONFIG_ARM_IMX6Q_CPUFREQ)		+= imx6q-cpufreq.o
diff --git a/drivers/cpufreq/dbx500-cpufreq.c b/drivers/cpufreq/dbx500-cpufreq.c
deleted file mode 100644
index 4ee0431579c1..000000000000
--- a/drivers/cpufreq/dbx500-cpufreq.c
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * Copyright (C) STMicroelectronics 2009
- * Copyright (C) ST-Ericsson SA 2010-2012
- *
- * License Terms: GNU General Public License v2
- * Author: Sundar Iyer <sundar.iyer@stericsson.com>
- * Author: Martin Persson <martin.persson@stericsson.com>
- * Author: Jonas Aaberg <jonas.aberg@stericsson.com>
- */
-
-#include <linux/module.h>
-#include <linux/kernel.h>
-#include <linux/cpufreq.h>
-#include <linux/cpu_cooling.h>
-#include <linux/delay.h>
-#include <linux/slab.h>
-#include <linux/platform_device.h>
-#include <linux/clk.h>
-
-static struct cpufreq_frequency_table *freq_table;
-static struct clk *armss_clk;
-static struct thermal_cooling_device *cdev;
-
-static int dbx500_cpufreq_target(struct cpufreq_policy *policy,
-				unsigned int index)
-{
-	/* update armss clk frequency */
-	return clk_set_rate(armss_clk, freq_table[index].frequency * 1000);
-}
-
-static int dbx500_cpufreq_init(struct cpufreq_policy *policy)
-{
-	policy->clk = armss_clk;
-	return cpufreq_generic_init(policy, freq_table, 20 * 1000);
-}
-
-static int dbx500_cpufreq_exit(struct cpufreq_policy *policy)
-{
-	if (!IS_ERR(cdev))
-		cpufreq_cooling_unregister(cdev);
-	return 0;
-}
-
-static void dbx500_cpufreq_ready(struct cpufreq_policy *policy)
-{
-	cdev = cpufreq_cooling_register(policy);
-	if (IS_ERR(cdev))
-		pr_err("Failed to register cooling device %ld\n", PTR_ERR(cdev));
-	else
-		pr_info("Cooling device registered: %s\n", cdev->type);
-}
-
-static struct cpufreq_driver dbx500_cpufreq_driver = {
-	.flags  = CPUFREQ_STICKY | CPUFREQ_CONST_LOOPS |
-			CPUFREQ_NEED_INITIAL_FREQ_CHECK,
-	.verify = cpufreq_generic_frequency_table_verify,
-	.target_index = dbx500_cpufreq_target,
-	.get    = cpufreq_generic_get,
-	.init   = dbx500_cpufreq_init,
-	.exit  = dbx500_cpufreq_exit,
-	.ready  = dbx500_cpufreq_ready,
-	.name   = "DBX500",
-	.attr   = cpufreq_generic_attr,
-};
-
-static int dbx500_cpufreq_probe(struct platform_device *pdev)
-{
-	struct cpufreq_frequency_table *pos;
-
-	freq_table = dev_get_platdata(&pdev->dev);
-	if (!freq_table) {
-		pr_err("dbx500-cpufreq: Failed to fetch cpufreq table\n");
-		return -ENODEV;
-	}
-
-	armss_clk = clk_get(&pdev->dev, "armss");
-	if (IS_ERR(armss_clk)) {
-		pr_err("dbx500-cpufreq: Failed to get armss clk\n");
-		return PTR_ERR(armss_clk);
-	}
-
-	pr_info("dbx500-cpufreq: Available frequencies:\n");
-	cpufreq_for_each_entry(pos, freq_table)
-		pr_info("  %d Mhz\n", pos->frequency / 1000);
-
-	return cpufreq_register_driver(&dbx500_cpufreq_driver);
-}
-
-static struct platform_driver dbx500_cpufreq_plat_driver = {
-	.driver = {
-		.name = "cpufreq-ux500",
-	},
-	.probe = dbx500_cpufreq_probe,
-};
-
-static int __init dbx500_cpufreq_register(void)
-{
-	return platform_driver_register(&dbx500_cpufreq_plat_driver);
-}
-device_initcall(dbx500_cpufreq_register);
-
-MODULE_LICENSE("GPL v2");
-MODULE_DESCRIPTION("cpufreq driver for DBX500");
-- 
2.9.4

^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCH 4/4] cpufreq: dbx500: Delete obsolete driver
@ 2017-08-10 12:52   ` Linus Walleij
  0 siblings, 0 replies; 26+ messages in thread
From: Linus Walleij @ 2017-08-10 12:52 UTC (permalink / raw)
  To: linux-arm-kernel

We have moved the Ux500 over to use the generic DT based
cpufreq driver, so delete the old custom driver.

At the same time select CPUFREQ_DT from the machine's
Kconfig in order to satisfy the "default ARCH_U8500"
selection on the old driver.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
 arch/arm/mach-ux500/Kconfig      |   1 +
 drivers/cpufreq/Kconfig.arm      |   9 ----
 drivers/cpufreq/Makefile         |   1 -
 drivers/cpufreq/dbx500-cpufreq.c | 103 ---------------------------------------
 4 files changed, 1 insertion(+), 113 deletions(-)
 delete mode 100644 drivers/cpufreq/dbx500-cpufreq.c

diff --git a/arch/arm/mach-ux500/Kconfig b/arch/arm/mach-ux500/Kconfig
index 4740ac393297..2b56e4af5a27 100644
--- a/arch/arm/mach-ux500/Kconfig
+++ b/arch/arm/mach-ux500/Kconfig
@@ -9,6 +9,7 @@ menuconfig ARCH_U8500
 	select ARM_GIC
 	select CACHE_L2X0
 	select CLKSRC_NOMADIK_MTU
+	select CPUFREQ_DT
 	select GPIOLIB
 	select HAVE_ARM_SCU if SMP
 	select HAVE_ARM_TWD if SMP
diff --git a/drivers/cpufreq/Kconfig.arm b/drivers/cpufreq/Kconfig.arm
index 2011fec2d6ad..74ed7e9a7f27 100644
--- a/drivers/cpufreq/Kconfig.arm
+++ b/drivers/cpufreq/Kconfig.arm
@@ -71,15 +71,6 @@ config ARM_HIGHBANK_CPUFREQ
 
 	  If in doubt, say N.
 
-config ARM_DB8500_CPUFREQ
-	tristate "ST-Ericsson DB8500 cpufreq" if COMPILE_TEST && !ARCH_U8500
-	default ARCH_U8500
-	depends on HAS_IOMEM
-	depends on !CPU_THERMAL || THERMAL
-	help
-	  This adds the CPUFreq driver for ST-Ericsson Ux500 (DB8500) SoC
-	  series.
-
 config ARM_IMX6Q_CPUFREQ
 	tristate "Freescale i.MX6 cpufreq support"
 	depends on ARCH_MXC
diff --git a/drivers/cpufreq/Makefile b/drivers/cpufreq/Makefile
index ab3a42cd29ef..a07c6efe4910 100644
--- a/drivers/cpufreq/Makefile
+++ b/drivers/cpufreq/Makefile
@@ -53,7 +53,6 @@ obj-$(CONFIG_ARM_DT_BL_CPUFREQ)		+= arm_big_little_dt.o
 
 obj-$(CONFIG_ARM_BRCMSTB_AVS_CPUFREQ)	+= brcmstb-avs-cpufreq.o
 obj-$(CONFIG_ARCH_DAVINCI)		+= davinci-cpufreq.o
-obj-$(CONFIG_ARM_DB8500_CPUFREQ)	+= dbx500-cpufreq.o
 obj-$(CONFIG_ARM_EXYNOS5440_CPUFREQ)	+= exynos5440-cpufreq.o
 obj-$(CONFIG_ARM_HIGHBANK_CPUFREQ)	+= highbank-cpufreq.o
 obj-$(CONFIG_ARM_IMX6Q_CPUFREQ)		+= imx6q-cpufreq.o
diff --git a/drivers/cpufreq/dbx500-cpufreq.c b/drivers/cpufreq/dbx500-cpufreq.c
deleted file mode 100644
index 4ee0431579c1..000000000000
--- a/drivers/cpufreq/dbx500-cpufreq.c
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * Copyright (C) STMicroelectronics 2009
- * Copyright (C) ST-Ericsson SA 2010-2012
- *
- * License Terms: GNU General Public License v2
- * Author: Sundar Iyer <sundar.iyer@stericsson.com>
- * Author: Martin Persson <martin.persson@stericsson.com>
- * Author: Jonas Aaberg <jonas.aberg@stericsson.com>
- */
-
-#include <linux/module.h>
-#include <linux/kernel.h>
-#include <linux/cpufreq.h>
-#include <linux/cpu_cooling.h>
-#include <linux/delay.h>
-#include <linux/slab.h>
-#include <linux/platform_device.h>
-#include <linux/clk.h>
-
-static struct cpufreq_frequency_table *freq_table;
-static struct clk *armss_clk;
-static struct thermal_cooling_device *cdev;
-
-static int dbx500_cpufreq_target(struct cpufreq_policy *policy,
-				unsigned int index)
-{
-	/* update armss clk frequency */
-	return clk_set_rate(armss_clk, freq_table[index].frequency * 1000);
-}
-
-static int dbx500_cpufreq_init(struct cpufreq_policy *policy)
-{
-	policy->clk = armss_clk;
-	return cpufreq_generic_init(policy, freq_table, 20 * 1000);
-}
-
-static int dbx500_cpufreq_exit(struct cpufreq_policy *policy)
-{
-	if (!IS_ERR(cdev))
-		cpufreq_cooling_unregister(cdev);
-	return 0;
-}
-
-static void dbx500_cpufreq_ready(struct cpufreq_policy *policy)
-{
-	cdev = cpufreq_cooling_register(policy);
-	if (IS_ERR(cdev))
-		pr_err("Failed to register cooling device %ld\n", PTR_ERR(cdev));
-	else
-		pr_info("Cooling device registered: %s\n", cdev->type);
-}
-
-static struct cpufreq_driver dbx500_cpufreq_driver = {
-	.flags  = CPUFREQ_STICKY | CPUFREQ_CONST_LOOPS |
-			CPUFREQ_NEED_INITIAL_FREQ_CHECK,
-	.verify = cpufreq_generic_frequency_table_verify,
-	.target_index = dbx500_cpufreq_target,
-	.get    = cpufreq_generic_get,
-	.init   = dbx500_cpufreq_init,
-	.exit  = dbx500_cpufreq_exit,
-	.ready  = dbx500_cpufreq_ready,
-	.name   = "DBX500",
-	.attr   = cpufreq_generic_attr,
-};
-
-static int dbx500_cpufreq_probe(struct platform_device *pdev)
-{
-	struct cpufreq_frequency_table *pos;
-
-	freq_table = dev_get_platdata(&pdev->dev);
-	if (!freq_table) {
-		pr_err("dbx500-cpufreq: Failed to fetch cpufreq table\n");
-		return -ENODEV;
-	}
-
-	armss_clk = clk_get(&pdev->dev, "armss");
-	if (IS_ERR(armss_clk)) {
-		pr_err("dbx500-cpufreq: Failed to get armss clk\n");
-		return PTR_ERR(armss_clk);
-	}
-
-	pr_info("dbx500-cpufreq: Available frequencies:\n");
-	cpufreq_for_each_entry(pos, freq_table)
-		pr_info("  %d Mhz\n", pos->frequency / 1000);
-
-	return cpufreq_register_driver(&dbx500_cpufreq_driver);
-}
-
-static struct platform_driver dbx500_cpufreq_plat_driver = {
-	.driver = {
-		.name = "cpufreq-ux500",
-	},
-	.probe = dbx500_cpufreq_probe,
-};
-
-static int __init dbx500_cpufreq_register(void)
-{
-	return platform_driver_register(&dbx500_cpufreq_plat_driver);
-}
-device_initcall(dbx500_cpufreq_register);
-
-MODULE_LICENSE("GPL v2");
-MODULE_DESCRIPTION("cpufreq driver for DBX500");
-- 
2.9.4

^ permalink raw reply related	[flat|nested] 26+ messages in thread

* Re: [PATCH 1/4] ARM: dts: augment Ux500 to use DT cpufreq
  2017-08-10 12:52   ` Linus Walleij
@ 2017-08-11  5:15     ` Viresh Kumar
  -1 siblings, 0 replies; 26+ messages in thread
From: Viresh Kumar @ 2017-08-11  5:15 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Rafael J . Wysocki, Lee Jones, linux-pm, linux-arm-kernel,
	Arnd Bergmann, Ulf Hansson

On 10-08-17, 14:52, Linus Walleij wrote:
> This adds the operating points to the Ux500 device tree and
> deletes the old special-purpose cpufreq node, as we can now
> use the generic DT cpufreq driver.
> 
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> ---
> Viresh et al: I will merge this into ARM SoC separately from
> the rest of the patches once we agree on this approach.

Sure, no worries.

> ---
>  arch/arm/boot/dts/ste-dbx5x0.dtsi | 15 ++++++++-------
>  1 file changed, 8 insertions(+), 7 deletions(-)
> 
> diff --git a/arch/arm/boot/dts/ste-dbx5x0.dtsi b/arch/arm/boot/dts/ste-dbx5x0.dtsi
> index 6c5affe2d0f5..2310a4e97768 100644
> --- a/arch/arm/boot/dts/ste-dbx5x0.dtsi
> +++ b/arch/arm/boot/dts/ste-dbx5x0.dtsi
> @@ -37,6 +37,14 @@
>  			device_type = "cpu";
>  			compatible = "arm,cortex-a9";
>  			reg = <0x300>;
> +			/* cpufreq controls */
> +			operating-points = <998400 0
> +					    800000 0
> +					    400000 0
> +					    200000 0>;
> +			clocks = <&prcmu_clk PRCMU_ARMSS>;
> +			clock-names = "cpu";
> +			clock-latency = <20000>;
>  		};
>  		CPU1: cpu@301 {
>  			device_type = "cpu";
> @@ -494,13 +502,6 @@
>  				reg = <0x80157450 0xC>;
>  			};
>  
> -			cpufreq {
> -				compatible = "stericsson,cpufreq-ux500";
> -				clocks = <&prcmu_clk PRCMU_ARMSS>;
> -				clock-names = "armss";
> -				status = "disabled";
> -			};
> -

This is relieving :)

But this solution isn't the best really, though you may not face any
issues with your use case.

For example, below will fail cpufreq on your board. You can try that
to make sure I am not dreaming.

- Compile cpufreq-dt as a module.
- Boot the board.
- Offline CPU0 (i.e. Keep only CPU1 online).
- Boom, cpufreq failed.

This will happen because the CPU1 doesn't have the operating-points
and other properties. We should have them in all the CPUs.

In order to not repeat the OPP table for all CPUs, you can use the new
operating-points-v2 bindings and mark the OPP table shared.

-- 
viresh

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [PATCH 1/4] ARM: dts: augment Ux500 to use DT cpufreq
@ 2017-08-11  5:15     ` Viresh Kumar
  0 siblings, 0 replies; 26+ messages in thread
From: Viresh Kumar @ 2017-08-11  5:15 UTC (permalink / raw)
  To: linux-arm-kernel

On 10-08-17, 14:52, Linus Walleij wrote:
> This adds the operating points to the Ux500 device tree and
> deletes the old special-purpose cpufreq node, as we can now
> use the generic DT cpufreq driver.
> 
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> ---
> Viresh et al: I will merge this into ARM SoC separately from
> the rest of the patches once we agree on this approach.

Sure, no worries.

> ---
>  arch/arm/boot/dts/ste-dbx5x0.dtsi | 15 ++++++++-------
>  1 file changed, 8 insertions(+), 7 deletions(-)
> 
> diff --git a/arch/arm/boot/dts/ste-dbx5x0.dtsi b/arch/arm/boot/dts/ste-dbx5x0.dtsi
> index 6c5affe2d0f5..2310a4e97768 100644
> --- a/arch/arm/boot/dts/ste-dbx5x0.dtsi
> +++ b/arch/arm/boot/dts/ste-dbx5x0.dtsi
> @@ -37,6 +37,14 @@
>  			device_type = "cpu";
>  			compatible = "arm,cortex-a9";
>  			reg = <0x300>;
> +			/* cpufreq controls */
> +			operating-points = <998400 0
> +					    800000 0
> +					    400000 0
> +					    200000 0>;
> +			clocks = <&prcmu_clk PRCMU_ARMSS>;
> +			clock-names = "cpu";
> +			clock-latency = <20000>;
>  		};
>  		CPU1: cpu at 301 {
>  			device_type = "cpu";
> @@ -494,13 +502,6 @@
>  				reg = <0x80157450 0xC>;
>  			};
>  
> -			cpufreq {
> -				compatible = "stericsson,cpufreq-ux500";
> -				clocks = <&prcmu_clk PRCMU_ARMSS>;
> -				clock-names = "armss";
> -				status = "disabled";
> -			};
> -

This is relieving :)

But this solution isn't the best really, though you may not face any
issues with your use case.

For example, below will fail cpufreq on your board. You can try that
to make sure I am not dreaming.

- Compile cpufreq-dt as a module.
- Boot the board.
- Offline CPU0 (i.e. Keep only CPU1 online).
- Boom, cpufreq failed.

This will happen because the CPU1 doesn't have the operating-points
and other properties. We should have them in all the CPUs.

In order to not repeat the OPP table for all CPUs, you can use the new
operating-points-v2 bindings and mark the OPP table shared.

-- 
viresh

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH 4/4] cpufreq: dbx500: Delete obsolete driver
  2017-08-10 12:52   ` Linus Walleij
@ 2017-08-11  5:17     ` Viresh Kumar
  -1 siblings, 0 replies; 26+ messages in thread
From: Viresh Kumar @ 2017-08-11  5:17 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Rafael J . Wysocki, Lee Jones, linux-pm, linux-arm-kernel,
	Arnd Bergmann, Ulf Hansson

On 10-08-17, 14:52, Linus Walleij wrote:
> We have moved the Ux500 over to use the generic DT based
> cpufreq driver, so delete the old custom driver.
> 
> At the same time select CPUFREQ_DT from the machine's
> Kconfig in order to satisfy the "default ARCH_U8500"
> selection on the old driver.
> 
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> ---
>  arch/arm/mach-ux500/Kconfig      |   1 +
>  drivers/cpufreq/Kconfig.arm      |   9 ----
>  drivers/cpufreq/Makefile         |   1 -
>  drivers/cpufreq/dbx500-cpufreq.c | 103 ---------------------------------------
>  4 files changed, 1 insertion(+), 113 deletions(-)
>  delete mode 100644 drivers/cpufreq/dbx500-cpufreq.c

Acked-by: Viresh Kumar <viresh.kumar@linaro.org>

-- 
viresh

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [PATCH 4/4] cpufreq: dbx500: Delete obsolete driver
@ 2017-08-11  5:17     ` Viresh Kumar
  0 siblings, 0 replies; 26+ messages in thread
From: Viresh Kumar @ 2017-08-11  5:17 UTC (permalink / raw)
  To: linux-arm-kernel

On 10-08-17, 14:52, Linus Walleij wrote:
> We have moved the Ux500 over to use the generic DT based
> cpufreq driver, so delete the old custom driver.
> 
> At the same time select CPUFREQ_DT from the machine's
> Kconfig in order to satisfy the "default ARCH_U8500"
> selection on the old driver.
> 
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> ---
>  arch/arm/mach-ux500/Kconfig      |   1 +
>  drivers/cpufreq/Kconfig.arm      |   9 ----
>  drivers/cpufreq/Makefile         |   1 -
>  drivers/cpufreq/dbx500-cpufreq.c | 103 ---------------------------------------
>  4 files changed, 1 insertion(+), 113 deletions(-)
>  delete mode 100644 drivers/cpufreq/dbx500-cpufreq.c

Acked-by: Viresh Kumar <viresh.kumar@linaro.org>

-- 
viresh

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH 2/4] cpufreq: enable the DT cpufreq driver on the Ux500
  2017-08-10 12:52   ` Linus Walleij
@ 2017-08-11  5:17     ` Viresh Kumar
  -1 siblings, 0 replies; 26+ messages in thread
From: Viresh Kumar @ 2017-08-11  5:17 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Rafael J . Wysocki, Lee Jones, linux-pm, linux-arm-kernel,
	Arnd Bergmann, Ulf Hansson

On 10-08-17, 14:52, Linus Walleij wrote:
> This enables the generic DT and OPP-based cpufreq driver on the
> ST-Ericsson Ux500 series.
> 
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> ---
>  drivers/cpufreq/cpufreq-dt-platdev.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/drivers/cpufreq/cpufreq-dt-platdev.c b/drivers/cpufreq/cpufreq-dt-platdev.c
> index 1c262923fe58..d80300251bc4 100644
> --- a/drivers/cpufreq/cpufreq-dt-platdev.c
> +++ b/drivers/cpufreq/cpufreq-dt-platdev.c
> @@ -88,6 +88,11 @@ static const struct of_device_id machines[] __initconst = {
>  	{ .compatible = "socionext,uniphier-ld11", },
>  	{ .compatible = "socionext,uniphier-ld20", },
>  
> +	{ .compatible = "st-ericsson,u8500", },
> +	{ .compatible = "st-ericsson,u8540", },
> +	{ .compatible = "st-ericsson,u9500", },
> +	{ .compatible = "st-ericsson,u9540", },
> +
>  	{ .compatible = "ti,omap2", },
>  	{ .compatible = "ti,omap3", },
>  	{ .compatible = "ti,omap4", },

Acked-by: Viresh Kumar <viresh.kumar@linaro.org>

-- 
viresh

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [PATCH 2/4] cpufreq: enable the DT cpufreq driver on the Ux500
@ 2017-08-11  5:17     ` Viresh Kumar
  0 siblings, 0 replies; 26+ messages in thread
From: Viresh Kumar @ 2017-08-11  5:17 UTC (permalink / raw)
  To: linux-arm-kernel

On 10-08-17, 14:52, Linus Walleij wrote:
> This enables the generic DT and OPP-based cpufreq driver on the
> ST-Ericsson Ux500 series.
> 
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> ---
>  drivers/cpufreq/cpufreq-dt-platdev.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/drivers/cpufreq/cpufreq-dt-platdev.c b/drivers/cpufreq/cpufreq-dt-platdev.c
> index 1c262923fe58..d80300251bc4 100644
> --- a/drivers/cpufreq/cpufreq-dt-platdev.c
> +++ b/drivers/cpufreq/cpufreq-dt-platdev.c
> @@ -88,6 +88,11 @@ static const struct of_device_id machines[] __initconst = {
>  	{ .compatible = "socionext,uniphier-ld11", },
>  	{ .compatible = "socionext,uniphier-ld20", },
>  
> +	{ .compatible = "st-ericsson,u8500", },
> +	{ .compatible = "st-ericsson,u8540", },
> +	{ .compatible = "st-ericsson,u9500", },
> +	{ .compatible = "st-ericsson,u9540", },
> +
>  	{ .compatible = "ti,omap2", },
>  	{ .compatible = "ti,omap3", },
>  	{ .compatible = "ti,omap4", },

Acked-by: Viresh Kumar <viresh.kumar@linaro.org>

-- 
viresh

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH 1/4] ARM: dts: augment Ux500 to use DT cpufreq
  2017-08-11  5:15     ` Viresh Kumar
@ 2017-08-13 12:23       ` Linus Walleij
  -1 siblings, 0 replies; 26+ messages in thread
From: Linus Walleij @ 2017-08-13 12:23 UTC (permalink / raw)
  To: Viresh Kumar
  Cc: Rafael J . Wysocki, Lee Jones, linux-pm, linux-arm-kernel,
	Arnd Bergmann, Ulf Hansson

On Fri, Aug 11, 2017 at 7:15 AM, Viresh Kumar <viresh.kumar@linaro.org> wrote:

> For example, below will fail cpufreq on your board. You can try that
> to make sure I am not dreaming.
>
> - Compile cpufreq-dt as a module.
> - Boot the board.
> - Offline CPU0 (i.e. Keep only CPU1 online).
> - Boom, cpufreq failed.
>
> This will happen because the CPU1 doesn't have the operating-points
> and other properties. We should have them in all the CPUs.

I don't think that will be a problem because CPU0 cannot be
taken offline on this system.

arch/arm/mach-ux500/platsmp.c surely only contain code to take
CPU1 online/offline.

At sleep, the BIOS/ROM handles taking down/up CPU0 so from
Linux' point of view that CPU is always online.

But I will look a bit closer and check.

This approach comes from the OMAP DT OPPs which also look like
this (and this system is similar).

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [PATCH 1/4] ARM: dts: augment Ux500 to use DT cpufreq
@ 2017-08-13 12:23       ` Linus Walleij
  0 siblings, 0 replies; 26+ messages in thread
From: Linus Walleij @ 2017-08-13 12:23 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Aug 11, 2017 at 7:15 AM, Viresh Kumar <viresh.kumar@linaro.org> wrote:

> For example, below will fail cpufreq on your board. You can try that
> to make sure I am not dreaming.
>
> - Compile cpufreq-dt as a module.
> - Boot the board.
> - Offline CPU0 (i.e. Keep only CPU1 online).
> - Boom, cpufreq failed.
>
> This will happen because the CPU1 doesn't have the operating-points
> and other properties. We should have them in all the CPUs.

I don't think that will be a problem because CPU0 cannot be
taken offline on this system.

arch/arm/mach-ux500/platsmp.c surely only contain code to take
CPU1 online/offline.

At sleep, the BIOS/ROM handles taking down/up CPU0 so from
Linux' point of view that CPU is always online.

But I will look a bit closer and check.

This approach comes from the OMAP DT OPPs which also look like
this (and this system is similar).

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH 3/4] mfd: db8500-prcmu: Get rid of cpufreq dependency
  2017-08-10 12:52   ` Linus Walleij
@ 2017-08-14  7:07     ` Lee Jones
  -1 siblings, 0 replies; 26+ messages in thread
From: Lee Jones @ 2017-08-14  7:07 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Rafael J . Wysocki, Viresh Kumar, linux-pm, linux-arm-kernel,
	Arnd Bergmann, Ulf Hansson

On Thu, 10 Aug 2017, Linus Walleij wrote:

> The ARMSS clock, also known as the operating point of the
> CPU, should not cross-depend on cpufreq like this. Move
> the code to use just frequencies and remove the false
> frequency (1GHz) and put in the actual frequency provided
> by the ARMSS clock (998400000 Hz) as part of the process.
> 
> After this and the related cpufreq patch, the DB8500 will
> simply use the standard DT cpufreq driver to change the
> operating points through the common clock framework using
> the ARMSS clock.
> 
> Cc: Lee Jones <lee.jones@linaro.org>
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> ---
> Lee, this needs to be merged together with the other
> related cpufreq patches, so an ACK to take this through
> the cpufreq subsystem would be appreciated once you're
> pleased with it.
> ---
>  drivers/mfd/db8500-prcmu.c | 59 +++++++++++++---------------------------------
>  1 file changed, 17 insertions(+), 42 deletions(-)

Make sure this passes checkpatch.pl.

> diff --git a/drivers/mfd/db8500-prcmu.c b/drivers/mfd/db8500-prcmu.c
> index 5c739ac752e8..a66be0203ece 100644
> --- a/drivers/mfd/db8500-prcmu.c
> +++ b/drivers/mfd/db8500-prcmu.c
> @@ -33,7 +33,6 @@
>  #include <linux/mfd/abx500/ab8500.h>
>  #include <linux/regulator/db8500-prcmu.h>
>  #include <linux/regulator/machine.h>
> -#include <linux/cpufreq.h>
>  #include <linux/platform_data/ux500_wdt.h>
>  #include <linux/platform_data/db8500_thermal.h>
>  #include "dbx500-prcmu-regs.h"
> @@ -1692,32 +1691,22 @@ static long round_clock_rate(u8 clock, unsigned long rate)
>  	return rounded_rate;
>  }
>  
> -/* CPU FREQ table, may be changed due to if MAX_OPP is supported. */
> -static struct cpufreq_frequency_table db8500_cpufreq_table[] = {
> -	{ .frequency = 200000, .driver_data = ARM_EXTCLK,},
> -	{ .frequency = 400000, .driver_data = ARM_50_OPP,},
> -	{ .frequency = 800000, .driver_data = ARM_100_OPP,},
> -	{ .frequency = CPUFREQ_TABLE_END,}, /* To be used for MAX_OPP. */
> -	{ .frequency = CPUFREQ_TABLE_END,},
> -};
> +static const unsigned long armss_freqs[] = { 200000000, 400000000, 800000000, 998400000 };
>  
>  static long round_armss_rate(unsigned long rate)
>  {
> -	struct cpufreq_frequency_table *pos;
> -	long freq = 0;
> -
> -	/* cpufreq table frequencies is in KHz. */
> -	rate = rate / 1000;
> +	unsigned long freq = 0;
> +	int i;
>  
>  	/* Find the corresponding arm opp from the cpufreq table. */
> -	cpufreq_for_each_entry(pos, db8500_cpufreq_table) {
> -		freq = pos->frequency;
> -		if (freq == rate)
> +	for (i = 0; i < ARRAY_SIZE(armss_freqs); i++) {
> +		freq = armss_freqs[i];
> +		if (rate <= freq)
>  			break;
>  	}
>  
>  	/* Return the last valid value, even if a match was not found. */
> -	return freq * 1000;
> +	return freq;
>  }
>  
>  #define MIN_PLL_VCO_RATE 600000000ULL
> @@ -1854,21 +1843,23 @@ static void set_clock_rate(u8 clock, unsigned long rate)
>  
>  static int set_armss_rate(unsigned long rate)
>  {
> -	struct cpufreq_frequency_table *pos;
> -
> -	/* cpufreq table frequencies is in KHz. */
> -	rate = rate / 1000;
> +	unsigned long freq;
> +	u8 opps[] = { ARM_EXTCLK, ARM_50_OPP, ARM_100_OPP, ARM_MAX_OPP };
> +	int i;
>  
>  	/* Find the corresponding arm opp from the cpufreq table. */
> -	cpufreq_for_each_entry(pos, db8500_cpufreq_table)
> -		if (pos->frequency == rate)
> +	for (i = 0; i < ARRAY_SIZE(armss_freqs); i++) {
> +		freq = armss_freqs[i];
> +		if (rate == freq)
>  			break;
> +	}

Why don't you just call round_armss_rate()?

> -	if (pos->frequency != rate)
> +	if (rate != freq)
>  		return -EINVAL;
>  
>  	/* Set the new arm opp. */
> -	return db8500_prcmu_set_arm_opp(pos->driver_data);
> +	pr_debug("SET ARM OPP 0x%02x\n", opps[i]);

Add a '\n' here.

Once fixed please apply my:

For my own reference:
  Acked-for-MFD-by: Lee Jones <lee.jones@linaro.org>

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [PATCH 3/4] mfd: db8500-prcmu: Get rid of cpufreq dependency
@ 2017-08-14  7:07     ` Lee Jones
  0 siblings, 0 replies; 26+ messages in thread
From: Lee Jones @ 2017-08-14  7:07 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, 10 Aug 2017, Linus Walleij wrote:

> The ARMSS clock, also known as the operating point of the
> CPU, should not cross-depend on cpufreq like this. Move
> the code to use just frequencies and remove the false
> frequency (1GHz) and put in the actual frequency provided
> by the ARMSS clock (998400000 Hz) as part of the process.
> 
> After this and the related cpufreq patch, the DB8500 will
> simply use the standard DT cpufreq driver to change the
> operating points through the common clock framework using
> the ARMSS clock.
> 
> Cc: Lee Jones <lee.jones@linaro.org>
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> ---
> Lee, this needs to be merged together with the other
> related cpufreq patches, so an ACK to take this through
> the cpufreq subsystem would be appreciated once you're
> pleased with it.
> ---
>  drivers/mfd/db8500-prcmu.c | 59 +++++++++++++---------------------------------
>  1 file changed, 17 insertions(+), 42 deletions(-)

Make sure this passes checkpatch.pl.

> diff --git a/drivers/mfd/db8500-prcmu.c b/drivers/mfd/db8500-prcmu.c
> index 5c739ac752e8..a66be0203ece 100644
> --- a/drivers/mfd/db8500-prcmu.c
> +++ b/drivers/mfd/db8500-prcmu.c
> @@ -33,7 +33,6 @@
>  #include <linux/mfd/abx500/ab8500.h>
>  #include <linux/regulator/db8500-prcmu.h>
>  #include <linux/regulator/machine.h>
> -#include <linux/cpufreq.h>
>  #include <linux/platform_data/ux500_wdt.h>
>  #include <linux/platform_data/db8500_thermal.h>
>  #include "dbx500-prcmu-regs.h"
> @@ -1692,32 +1691,22 @@ static long round_clock_rate(u8 clock, unsigned long rate)
>  	return rounded_rate;
>  }
>  
> -/* CPU FREQ table, may be changed due to if MAX_OPP is supported. */
> -static struct cpufreq_frequency_table db8500_cpufreq_table[] = {
> -	{ .frequency = 200000, .driver_data = ARM_EXTCLK,},
> -	{ .frequency = 400000, .driver_data = ARM_50_OPP,},
> -	{ .frequency = 800000, .driver_data = ARM_100_OPP,},
> -	{ .frequency = CPUFREQ_TABLE_END,}, /* To be used for MAX_OPP. */
> -	{ .frequency = CPUFREQ_TABLE_END,},
> -};
> +static const unsigned long armss_freqs[] = { 200000000, 400000000, 800000000, 998400000 };
>  
>  static long round_armss_rate(unsigned long rate)
>  {
> -	struct cpufreq_frequency_table *pos;
> -	long freq = 0;
> -
> -	/* cpufreq table frequencies is in KHz. */
> -	rate = rate / 1000;
> +	unsigned long freq = 0;
> +	int i;
>  
>  	/* Find the corresponding arm opp from the cpufreq table. */
> -	cpufreq_for_each_entry(pos, db8500_cpufreq_table) {
> -		freq = pos->frequency;
> -		if (freq == rate)
> +	for (i = 0; i < ARRAY_SIZE(armss_freqs); i++) {
> +		freq = armss_freqs[i];
> +		if (rate <= freq)
>  			break;
>  	}
>  
>  	/* Return the last valid value, even if a match was not found. */
> -	return freq * 1000;
> +	return freq;
>  }
>  
>  #define MIN_PLL_VCO_RATE 600000000ULL
> @@ -1854,21 +1843,23 @@ static void set_clock_rate(u8 clock, unsigned long rate)
>  
>  static int set_armss_rate(unsigned long rate)
>  {
> -	struct cpufreq_frequency_table *pos;
> -
> -	/* cpufreq table frequencies is in KHz. */
> -	rate = rate / 1000;
> +	unsigned long freq;
> +	u8 opps[] = { ARM_EXTCLK, ARM_50_OPP, ARM_100_OPP, ARM_MAX_OPP };
> +	int i;
>  
>  	/* Find the corresponding arm opp from the cpufreq table. */
> -	cpufreq_for_each_entry(pos, db8500_cpufreq_table)
> -		if (pos->frequency == rate)
> +	for (i = 0; i < ARRAY_SIZE(armss_freqs); i++) {
> +		freq = armss_freqs[i];
> +		if (rate == freq)
>  			break;
> +	}

Why don't you just call round_armss_rate()?

> -	if (pos->frequency != rate)
> +	if (rate != freq)
>  		return -EINVAL;
>  
>  	/* Set the new arm opp. */
> -	return db8500_prcmu_set_arm_opp(pos->driver_data);
> +	pr_debug("SET ARM OPP 0x%02x\n", opps[i]);

Add a '\n' here.

Once fixed please apply my:

For my own reference:
  Acked-for-MFD-by: Lee Jones <lee.jones@linaro.org>

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org ? Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH 1/4] ARM: dts: augment Ux500 to use DT cpufreq
  2017-08-13 12:23       ` Linus Walleij
@ 2017-08-16  3:26         ` Viresh Kumar
  -1 siblings, 0 replies; 26+ messages in thread
From: Viresh Kumar @ 2017-08-16  3:26 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Rafael J . Wysocki, Lee Jones, linux-pm, linux-arm-kernel,
	Arnd Bergmann, Ulf Hansson

On 13-08-17, 14:23, Linus Walleij wrote:
> On Fri, Aug 11, 2017 at 7:15 AM, Viresh Kumar <viresh.kumar@linaro.org> wrote:
> 
> > For example, below will fail cpufreq on your board. You can try that
> > to make sure I am not dreaming.
> >
> > - Compile cpufreq-dt as a module.
> > - Boot the board.
> > - Offline CPU0 (i.e. Keep only CPU1 online).
> > - Boom, cpufreq failed.
> >
> > This will happen because the CPU1 doesn't have the operating-points
> > and other properties. We should have them in all the CPUs.
> 
> I don't think that will be a problem because CPU0 cannot be
> taken offline on this system.

Should be fine then.

-- 
viresh

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [PATCH 1/4] ARM: dts: augment Ux500 to use DT cpufreq
@ 2017-08-16  3:26         ` Viresh Kumar
  0 siblings, 0 replies; 26+ messages in thread
From: Viresh Kumar @ 2017-08-16  3:26 UTC (permalink / raw)
  To: linux-arm-kernel

On 13-08-17, 14:23, Linus Walleij wrote:
> On Fri, Aug 11, 2017 at 7:15 AM, Viresh Kumar <viresh.kumar@linaro.org> wrote:
> 
> > For example, below will fail cpufreq on your board. You can try that
> > to make sure I am not dreaming.
> >
> > - Compile cpufreq-dt as a module.
> > - Boot the board.
> > - Offline CPU0 (i.e. Keep only CPU1 online).
> > - Boom, cpufreq failed.
> >
> > This will happen because the CPU1 doesn't have the operating-points
> > and other properties. We should have them in all the CPUs.
> 
> I don't think that will be a problem because CPU0 cannot be
> taken offline on this system.

Should be fine then.

-- 
viresh

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH 3/4] mfd: db8500-prcmu: Get rid of cpufreq dependency
  2017-08-14  7:07     ` Lee Jones
@ 2017-08-16  8:16       ` Linus Walleij
  -1 siblings, 0 replies; 26+ messages in thread
From: Linus Walleij @ 2017-08-16  8:16 UTC (permalink / raw)
  To: Lee Jones
  Cc: Rafael J . Wysocki, Viresh Kumar, linux-pm, linux-arm-kernel,
	Arnd Bergmann, Ulf Hansson

On Mon, Aug 14, 2017 at 9:07 AM, Lee Jones <lee.jones@linaro.org> wrote:
> On Thu, 10 Aug 2017, Linus Walleij wrote:
>
>> The ARMSS clock, also known as the operating point of the
>> CPU, should not cross-depend on cpufreq like this. Move
>> the code to use just frequencies and remove the false
>> frequency (1GHz) and put in the actual frequency provided
>> by the ARMSS clock (998400000 Hz) as part of the process.
>>
>> After this and the related cpufreq patch, the DB8500 will
>> simply use the standard DT cpufreq driver to change the
>> operating points through the common clock framework using
>> the ARMSS clock.
>>
>> Cc: Lee Jones <lee.jones@linaro.org>
>> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

>>  drivers/mfd/db8500-prcmu.c | 59 +++++++++++++---------------------------------
>>  1 file changed, 17 insertions(+), 42 deletions(-)
>
> Make sure this passes checkpatch.pl.

Sure thing :)
$ scripts/checkpatch.pl
cpufreq/0003-mfd-db8500-prcmu-Get-rid-of-cpufreq-dependency.patch
total: 0 errors, 0 warnings, 112 lines checked

cpufreq/0003-mfd-db8500-prcmu-Get-rid-of-cpufreq-dependency.patch has
no obvious style problems and is ready for submission.

>> +     int i;
>>
>>       /* Find the corresponding arm opp from the cpufreq table. */
>> -     cpufreq_for_each_entry(pos, db8500_cpufreq_table)
>> -             if (pos->frequency == rate)
>> +     for (i = 0; i < ARRAY_SIZE(armss_freqs); i++) {
>> +             freq = armss_freqs[i];
>> +             if (rate == freq)
>>                       break;
>> +     }
>
> Why don't you just call round_armss_rate()?

It's because I need the index of the located frequency (i), and the other
function due to being called from the clock framework has to have
that simple signature.

> Once fixed please apply my:
>
> For my own reference:
>   Acked-for-MFD-by: Lee Jones <lee.jones@linaro.org>

OK thanks!

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [PATCH 3/4] mfd: db8500-prcmu: Get rid of cpufreq dependency
@ 2017-08-16  8:16       ` Linus Walleij
  0 siblings, 0 replies; 26+ messages in thread
From: Linus Walleij @ 2017-08-16  8:16 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Aug 14, 2017 at 9:07 AM, Lee Jones <lee.jones@linaro.org> wrote:
> On Thu, 10 Aug 2017, Linus Walleij wrote:
>
>> The ARMSS clock, also known as the operating point of the
>> CPU, should not cross-depend on cpufreq like this. Move
>> the code to use just frequencies and remove the false
>> frequency (1GHz) and put in the actual frequency provided
>> by the ARMSS clock (998400000 Hz) as part of the process.
>>
>> After this and the related cpufreq patch, the DB8500 will
>> simply use the standard DT cpufreq driver to change the
>> operating points through the common clock framework using
>> the ARMSS clock.
>>
>> Cc: Lee Jones <lee.jones@linaro.org>
>> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

>>  drivers/mfd/db8500-prcmu.c | 59 +++++++++++++---------------------------------
>>  1 file changed, 17 insertions(+), 42 deletions(-)
>
> Make sure this passes checkpatch.pl.

Sure thing :)
$ scripts/checkpatch.pl
cpufreq/0003-mfd-db8500-prcmu-Get-rid-of-cpufreq-dependency.patch
total: 0 errors, 0 warnings, 112 lines checked

cpufreq/0003-mfd-db8500-prcmu-Get-rid-of-cpufreq-dependency.patch has
no obvious style problems and is ready for submission.

>> +     int i;
>>
>>       /* Find the corresponding arm opp from the cpufreq table. */
>> -     cpufreq_for_each_entry(pos, db8500_cpufreq_table)
>> -             if (pos->frequency == rate)
>> +     for (i = 0; i < ARRAY_SIZE(armss_freqs); i++) {
>> +             freq = armss_freqs[i];
>> +             if (rate == freq)
>>                       break;
>> +     }
>
> Why don't you just call round_armss_rate()?

It's because I need the index of the located frequency (i), and the other
function due to being called from the clock framework has to have
that simple signature.

> Once fixed please apply my:
>
> For my own reference:
>   Acked-for-MFD-by: Lee Jones <lee.jones@linaro.org>

OK thanks!

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH 3/4] mfd: db8500-prcmu: Get rid of cpufreq dependency
  2017-08-16  8:16       ` Linus Walleij
@ 2017-08-16 11:27         ` Lee Jones
  -1 siblings, 0 replies; 26+ messages in thread
From: Lee Jones @ 2017-08-16 11:27 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Rafael J . Wysocki, Viresh Kumar, linux-pm, linux-arm-kernel,
	Arnd Bergmann, Ulf Hansson

On Wed, 16 Aug 2017, Linus Walleij wrote:

> On Mon, Aug 14, 2017 at 9:07 AM, Lee Jones <lee.jones@linaro.org> wrote:
> > On Thu, 10 Aug 2017, Linus Walleij wrote:
> >
> >> The ARMSS clock, also known as the operating point of the
> >> CPU, should not cross-depend on cpufreq like this. Move
> >> the code to use just frequencies and remove the false
> >> frequency (1GHz) and put in the actual frequency provided
> >> by the ARMSS clock (998400000 Hz) as part of the process.
> >>
> >> After this and the related cpufreq patch, the DB8500 will
> >> simply use the standard DT cpufreq driver to change the
> >> operating points through the common clock framework using
> >> the ARMSS clock.
> >>
> >> Cc: Lee Jones <lee.jones@linaro.org>
> >> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> 
> >>  drivers/mfd/db8500-prcmu.c | 59 +++++++++++++---------------------------------
> >>  1 file changed, 17 insertions(+), 42 deletions(-)
> >
> > Make sure this passes checkpatch.pl.
> 
> Sure thing :)
> $ scripts/checkpatch.pl
> cpufreq/0003-mfd-db8500-prcmu-Get-rid-of-cpufreq-dependency.patch
> total: 0 errors, 0 warnings, 112 lines checked
> 
> cpufreq/0003-mfd-db8500-prcmu-Get-rid-of-cpufreq-dependency.patch has
> no obvious style problems and is ready for submission.
>
Strange, this line looks way over 80 chars:

static const unsigned long armss_freqs[] = { 200000000, 400000000, 800000000, 998400000 };

Although when I look at it in Gmail, you appear to have a '\n' in
here, very odd.

Anyway, even if the '\n' is in there, please format it like:

static const unsigned long armss_freqs[] = {
	200000000,
	400000000,
	800000000,
	998400000
};


> >> +     int i;
> >>
> >>       /* Find the corresponding arm opp from the cpufreq table. */
> >> -     cpufreq_for_each_entry(pos, db8500_cpufreq_table)
> >> -             if (pos->frequency == rate)
> >> +     for (i = 0; i < ARRAY_SIZE(armss_freqs); i++) {
> >> +             freq = armss_freqs[i];
> >> +             if (rate == freq)
> >>                       break;
> >> +     }
> >
> > Why don't you just call round_armss_rate()?
> 
> It's because I need the index of the located frequency (i), and the other
> function due to being called from the clock framework has to have
> that simple signature.
> 
> > Once fixed please apply my:
> >
> > For my own reference:
> >   Acked-for-MFD-by: Lee Jones <lee.jones@linaro.org>
> 
> OK thanks!
> 
> Yours,
> Linus Walleij

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [PATCH 3/4] mfd: db8500-prcmu: Get rid of cpufreq dependency
@ 2017-08-16 11:27         ` Lee Jones
  0 siblings, 0 replies; 26+ messages in thread
From: Lee Jones @ 2017-08-16 11:27 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, 16 Aug 2017, Linus Walleij wrote:

> On Mon, Aug 14, 2017 at 9:07 AM, Lee Jones <lee.jones@linaro.org> wrote:
> > On Thu, 10 Aug 2017, Linus Walleij wrote:
> >
> >> The ARMSS clock, also known as the operating point of the
> >> CPU, should not cross-depend on cpufreq like this. Move
> >> the code to use just frequencies and remove the false
> >> frequency (1GHz) and put in the actual frequency provided
> >> by the ARMSS clock (998400000 Hz) as part of the process.
> >>
> >> After this and the related cpufreq patch, the DB8500 will
> >> simply use the standard DT cpufreq driver to change the
> >> operating points through the common clock framework using
> >> the ARMSS clock.
> >>
> >> Cc: Lee Jones <lee.jones@linaro.org>
> >> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> 
> >>  drivers/mfd/db8500-prcmu.c | 59 +++++++++++++---------------------------------
> >>  1 file changed, 17 insertions(+), 42 deletions(-)
> >
> > Make sure this passes checkpatch.pl.
> 
> Sure thing :)
> $ scripts/checkpatch.pl
> cpufreq/0003-mfd-db8500-prcmu-Get-rid-of-cpufreq-dependency.patch
> total: 0 errors, 0 warnings, 112 lines checked
> 
> cpufreq/0003-mfd-db8500-prcmu-Get-rid-of-cpufreq-dependency.patch has
> no obvious style problems and is ready for submission.
>
Strange, this line looks way over 80 chars:

static const unsigned long armss_freqs[] = { 200000000, 400000000, 800000000, 998400000 };

Although when I look at it in Gmail, you appear to have a '\n' in
here, very odd.

Anyway, even if the '\n' is in there, please format it like:

static const unsigned long armss_freqs[] = {
	200000000,
	400000000,
	800000000,
	998400000
};


> >> +     int i;
> >>
> >>       /* Find the corresponding arm opp from the cpufreq table. */
> >> -     cpufreq_for_each_entry(pos, db8500_cpufreq_table)
> >> -             if (pos->frequency == rate)
> >> +     for (i = 0; i < ARRAY_SIZE(armss_freqs); i++) {
> >> +             freq = armss_freqs[i];
> >> +             if (rate == freq)
> >>                       break;
> >> +     }
> >
> > Why don't you just call round_armss_rate()?
> 
> It's because I need the index of the located frequency (i), and the other
> function due to being called from the clock framework has to have
> that simple signature.
> 
> > Once fixed please apply my:
> >
> > For my own reference:
> >   Acked-for-MFD-by: Lee Jones <lee.jones@linaro.org>
> 
> OK thanks!
> 
> Yours,
> Linus Walleij

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org ? Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

^ permalink raw reply	[flat|nested] 26+ messages in thread

end of thread, other threads:[~2017-08-16 11:27 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-10 12:52 [PATCH 0/4] Switch Ux500 to use generic DT cpufreq Linus Walleij
2017-08-10 12:52 ` Linus Walleij
2017-08-10 12:52 ` [PATCH 1/4] ARM: dts: augment Ux500 to use " Linus Walleij
2017-08-10 12:52   ` Linus Walleij
2017-08-11  5:15   ` Viresh Kumar
2017-08-11  5:15     ` Viresh Kumar
2017-08-13 12:23     ` Linus Walleij
2017-08-13 12:23       ` Linus Walleij
2017-08-16  3:26       ` Viresh Kumar
2017-08-16  3:26         ` Viresh Kumar
2017-08-10 12:52 ` [PATCH 2/4] cpufreq: enable the DT cpufreq driver on the Ux500 Linus Walleij
2017-08-10 12:52   ` Linus Walleij
2017-08-11  5:17   ` Viresh Kumar
2017-08-11  5:17     ` Viresh Kumar
2017-08-10 12:52 ` [PATCH 3/4] mfd: db8500-prcmu: Get rid of cpufreq dependency Linus Walleij
2017-08-10 12:52   ` Linus Walleij
2017-08-14  7:07   ` Lee Jones
2017-08-14  7:07     ` Lee Jones
2017-08-16  8:16     ` Linus Walleij
2017-08-16  8:16       ` Linus Walleij
2017-08-16 11:27       ` Lee Jones
2017-08-16 11:27         ` Lee Jones
2017-08-10 12:52 ` [PATCH 4/4] cpufreq: dbx500: Delete obsolete driver Linus Walleij
2017-08-10 12:52   ` Linus Walleij
2017-08-11  5:17   ` Viresh Kumar
2017-08-11  5:17     ` Viresh Kumar

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.