linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] ARM: dts: imx7d: Update cpufreq OPP table
@ 2019-05-29 12:03 Leonard Crestez
  2019-05-29 12:03 ` [PATCH 2/3] ARM: imx_v6_v7_defconfig: Enable CONFIG_ARM_IMX_CPUFREQ_DT Leonard Crestez
  2019-05-29 12:03 ` [PATCH 3/3] cpufreq: Switch imx7d to imx-cpufreq-dt for speed grading Leonard Crestez
  0 siblings, 2 replies; 6+ messages in thread
From: Leonard Crestez @ 2019-05-29 12:03 UTC (permalink / raw)
  To: Viresh Kumar, Shawn Guo, Jacky Bai
  Cc: Aisheng Dong, Abel Vesa, Anson Huang, linux-pm,
	Rafael J. Wysocki, dl-linux-imx, kernel, Fabio Estevam,
	linux-arm-kernel

According to latest docs imx7d chips can go from 800 to 1200 mhz.
Maximum frequency is determined from two speed grading bits present in
OCOTP fuses at same location as other imx chips.

Also update to "typical" voltages from latest datasheet, 25mv higher
than current dts.

All imx7s parts are still fixed at 800mhz

Based on:
* IMX7DCEC Rev. 6, 03/2019
* IMX7SCEC Rev. 6, 03/2019
* IMX7DRM Rev. 1, 01/2018 Page 1102

Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
---
 arch/arm/boot/dts/imx7d.dtsi | 16 +++++++++++++---
 arch/arm/boot/dts/imx7s.dtsi |  4 ++++
 2 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/arch/arm/boot/dts/imx7d.dtsi b/arch/arm/boot/dts/imx7d.dtsi
index f33b560821b8..42528d2812a2 100644
--- a/arch/arm/boot/dts/imx7d.dtsi
+++ b/arch/arm/boot/dts/imx7d.dtsi
@@ -10,10 +10,12 @@
 	cpus {
 		cpu0: cpu@0 {
 			clock-frequency = <996000000>;
 			operating-points-v2 = <&cpu0_opp_table>;
 			#cooling-cells = <2>;
+			nvmem-cells = <&cpu_speed_grade>;
+			nvmem-cell-names = "speed_grade";
 		};
 
 		cpu1: cpu@1 {
 			compatible = "arm,cortex-a7";
 			device_type = "cpu";
@@ -37,19 +39,27 @@
 		compatible = "operating-points-v2";
 		opp-shared;
 
 		opp-792000000 {
 			opp-hz = /bits/ 64 <792000000>;
-			opp-microvolt = <975000>;
+			opp-microvolt = <1000000>;
 			clock-latency-ns = <150000>;
+			opp-supported-hw = <0xf>, <0xf>;
 		};
 
 		opp-996000000 {
 			opp-hz = /bits/ 64 <996000000>;
-			opp-microvolt = <1075000>;
+			opp-microvolt = <1100000>;
 			clock-latency-ns = <150000>;
-			opp-suspend;
+			opp-supported-hw = <0xc>, <0xf>;
+		};
+
+		opp-1200000000 {
+			opp-hz = /bits/ 64 <1200000000>;
+			opp-microvolt = <1225000>;
+			clock-latency-ns = <150000>;
+			opp-supported-hw = <0x8>, <0xf>;
 		};
 	};
 
 	usbphynop2: usbphynop2 {
 		compatible = "usb-nop-xceiv";
diff --git a/arch/arm/boot/dts/imx7s.dtsi b/arch/arm/boot/dts/imx7s.dtsi
index d8b4eb67146d..5b8292670b4b 100644
--- a/arch/arm/boot/dts/imx7s.dtsi
+++ b/arch/arm/boot/dts/imx7s.dtsi
@@ -549,10 +549,14 @@
 				};
 
 				tempmon_temp_grade: temp-grade@10 {
 					reg = <0x10 0x4>;
 				};
+
+				cpu_speed_grade: speed-grade@10 {
+					reg = <0x10 0x4>;
+				};
 			};
 
 			anatop: anatop@30360000 {
 				compatible = "fsl,imx7d-anatop", "fsl,imx6q-anatop",
 					"syscon", "simple-bus";
-- 
2.17.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH 2/3] ARM: imx_v6_v7_defconfig: Enable CONFIG_ARM_IMX_CPUFREQ_DT
  2019-05-29 12:03 [PATCH 1/3] ARM: dts: imx7d: Update cpufreq OPP table Leonard Crestez
@ 2019-05-29 12:03 ` Leonard Crestez
  2019-05-29 12:03 ` [PATCH 3/3] cpufreq: Switch imx7d to imx-cpufreq-dt for speed grading Leonard Crestez
  1 sibling, 0 replies; 6+ messages in thread
From: Leonard Crestez @ 2019-05-29 12:03 UTC (permalink / raw)
  To: Viresh Kumar, Shawn Guo, Jacky Bai
  Cc: Aisheng Dong, Abel Vesa, Anson Huang, linux-pm,
	Rafael J. Wysocki, dl-linux-imx, kernel, Fabio Estevam,
	linux-arm-kernel

This is used for imx7d speed grading.

Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
---
 arch/arm/configs/imx_v6_v7_defconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/configs/imx_v6_v7_defconfig b/arch/arm/configs/imx_v6_v7_defconfig
index 4daf807e6970..507c1fcca624 100644
--- a/arch/arm/configs/imx_v6_v7_defconfig
+++ b/arch/arm/configs/imx_v6_v7_defconfig
@@ -52,10 +52,11 @@ CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y
 CONFIG_CPU_FREQ_GOV_POWERSAVE=y
 CONFIG_CPU_FREQ_GOV_USERSPACE=y
 CONFIG_CPU_FREQ_GOV_CONSERVATIVE=y
 CONFIG_CPUFREQ_DT=y
 CONFIG_ARM_IMX6Q_CPUFREQ=y
+CONFIG_ARM_IMX_CPUFREQ_DT=y
 CONFIG_CPU_IDLE=y
 CONFIG_ARM_CPUIDLE=y
 CONFIG_VFP=y
 CONFIG_NEON=y
 CONFIG_PM_DEBUG=y
-- 
2.17.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH 3/3] cpufreq: Switch imx7d to imx-cpufreq-dt for speed grading
  2019-05-29 12:03 [PATCH 1/3] ARM: dts: imx7d: Update cpufreq OPP table Leonard Crestez
  2019-05-29 12:03 ` [PATCH 2/3] ARM: imx_v6_v7_defconfig: Enable CONFIG_ARM_IMX_CPUFREQ_DT Leonard Crestez
@ 2019-05-29 12:03 ` Leonard Crestez
  2019-06-03  5:38   ` Viresh Kumar
  1 sibling, 1 reply; 6+ messages in thread
From: Leonard Crestez @ 2019-05-29 12:03 UTC (permalink / raw)
  To: Viresh Kumar, Shawn Guo, Jacky Bai
  Cc: Aisheng Dong, Abel Vesa, Anson Huang, linux-pm,
	Rafael J. Wysocki, dl-linux-imx, kernel, Fabio Estevam,
	linux-arm-kernel

This driver can handle speed grading bits on imx7d just like on imx8mq
and imx8mm.

Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
---
 arch/arm/mach-imx/mach-imx7d.c       | 7 +++++++
 drivers/cpufreq/cpufreq-dt-platdev.c | 2 +-
 drivers/cpufreq/imx-cpufreq-dt.c     | 1 +
 3 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mach-imx/mach-imx7d.c b/arch/arm/mach-imx/mach-imx7d.c
index 26ca744d3e2b..0b77412795c9 100644
--- a/arch/arm/mach-imx/mach-imx7d.c
+++ b/arch/arm/mach-imx/mach-imx7d.c
@@ -95,10 +95,16 @@ static void __init imx7d_init_machine(void)
 
 	imx_anatop_init();
 	imx7d_enet_init();
 }
 
+static void __init imx7d_init_late(void)
+{
+	if (IS_ENABLED(CONFIG_ARM_IMX_CPUFREQ_DT))
+		platform_device_register_simple("imx-cpufreq-dt", -1, NULL, 0);
+}
+
 static void __init imx7d_init_irq(void)
 {
 	imx_init_revision_from_anatop();
 	imx_src_init();
 	irqchip_init();
@@ -111,7 +117,8 @@ static const char *const imx7d_dt_compat[] __initconst = {
 };
 
 DT_MACHINE_START(IMX7D, "Freescale i.MX7 Dual (Device Tree)")
 	.init_irq	= imx7d_init_irq,
 	.init_machine	= imx7d_init_machine,
+	.init_late      = imx7d_init_late,
 	.dt_compat	= imx7d_dt_compat,
 MACHINE_END
diff --git a/drivers/cpufreq/cpufreq-dt-platdev.c b/drivers/cpufreq/cpufreq-dt-platdev.c
index 19c1aad57e26..eb282dff9f2c 100644
--- a/drivers/cpufreq/cpufreq-dt-platdev.c
+++ b/drivers/cpufreq/cpufreq-dt-platdev.c
@@ -38,11 +38,10 @@ static const struct of_device_id whitelist[] __initconst = {
 	{ .compatible = "hisilicon,hi3660", },
 
 	{ .compatible = "fsl,imx27", },
 	{ .compatible = "fsl,imx51", },
 	{ .compatible = "fsl,imx53", },
-	{ .compatible = "fsl,imx7d", },
 
 	{ .compatible = "marvell,berlin", },
 	{ .compatible = "marvell,pxa250", },
 	{ .compatible = "marvell,pxa270", },
 
@@ -106,10 +105,11 @@ static const struct of_device_id whitelist[] __initconst = {
  */
 static const struct of_device_id blacklist[] __initconst = {
 	{ .compatible = "calxeda,highbank", },
 	{ .compatible = "calxeda,ecx-2000", },
 
+	{ .compatible = "fsl,imx7d", },
 	{ .compatible = "fsl,imx8mq", },
 	{ .compatible = "fsl,imx8mm", },
 
 	{ .compatible = "marvell,armadaxp", },
 
diff --git a/drivers/cpufreq/imx-cpufreq-dt.c b/drivers/cpufreq/imx-cpufreq-dt.c
index 5061503cb0a1..ce26ffc18ce6 100644
--- a/drivers/cpufreq/imx-cpufreq-dt.c
+++ b/drivers/cpufreq/imx-cpufreq-dt.c
@@ -18,10 +18,11 @@
 #define OCOTP_CFG3_SPEED_GRADE_MASK	(0x3 << 8)
 #define OCOTP_CFG3_MKT_SEGMENT_SHIFT    6
 #define OCOTP_CFG3_MKT_SEGMENT_MASK     (0x3 << 6)
 
 static const struct of_device_id imx_cpufreq_dt_match_list[] = {
+	{ .compatible = "fsl,imx7d" },
 	{ .compatible = "fsl,imx8mm" },
 	{ .compatible = "fsl,imx8mq" },
 	{}
 };
 
-- 
2.17.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH 3/3] cpufreq: Switch imx7d to imx-cpufreq-dt for speed grading
  2019-05-29 12:03 ` [PATCH 3/3] cpufreq: Switch imx7d to imx-cpufreq-dt for speed grading Leonard Crestez
@ 2019-06-03  5:38   ` Viresh Kumar
  2019-06-03  7:01     ` Leonard Crestez
  0 siblings, 1 reply; 6+ messages in thread
From: Viresh Kumar @ 2019-06-03  5:38 UTC (permalink / raw)
  To: Leonard Crestez
  Cc: Aisheng Dong, Jacky Bai, Anson Huang, linux-pm,
	Rafael J. Wysocki, dl-linux-imx, kernel, Fabio Estevam,
	Shawn Guo, linux-arm-kernel, Abel Vesa

On 29-05-19, 12:03, Leonard Crestez wrote:
> This driver can handle speed grading bits on imx7d just like on imx8mq
> and imx8mm.
> 
> Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
> ---
>  arch/arm/mach-imx/mach-imx7d.c       | 7 +++++++
>  drivers/cpufreq/cpufreq-dt-platdev.c | 2 +-
>  drivers/cpufreq/imx-cpufreq-dt.c     | 1 +
>  3 files changed, 9 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/arm/mach-imx/mach-imx7d.c b/arch/arm/mach-imx/mach-imx7d.c
> index 26ca744d3e2b..0b77412795c9 100644
> --- a/arch/arm/mach-imx/mach-imx7d.c
> +++ b/arch/arm/mach-imx/mach-imx7d.c
> @@ -95,10 +95,16 @@ static void __init imx7d_init_machine(void)
>  
>  	imx_anatop_init();
>  	imx7d_enet_init();
>  }
>  
> +static void __init imx7d_init_late(void)
> +{
> +	if (IS_ENABLED(CONFIG_ARM_IMX_CPUFREQ_DT))
> +		platform_device_register_simple("imx-cpufreq-dt", -1, NULL, 0);
> +}
> +
>  static void __init imx7d_init_irq(void)
>  {
>  	imx_init_revision_from_anatop();
>  	imx_src_init();
>  	irqchip_init();
> @@ -111,7 +117,8 @@ static const char *const imx7d_dt_compat[] __initconst = {
>  };
>  
>  DT_MACHINE_START(IMX7D, "Freescale i.MX7 Dual (Device Tree)")
>  	.init_irq	= imx7d_init_irq,
>  	.init_machine	= imx7d_init_machine,
> +	.init_late      = imx7d_init_late,
>  	.dt_compat	= imx7d_dt_compat,
>  MACHINE_END
> diff --git a/drivers/cpufreq/cpufreq-dt-platdev.c b/drivers/cpufreq/cpufreq-dt-platdev.c
> index 19c1aad57e26..eb282dff9f2c 100644
> --- a/drivers/cpufreq/cpufreq-dt-platdev.c
> +++ b/drivers/cpufreq/cpufreq-dt-platdev.c
> @@ -38,11 +38,10 @@ static const struct of_device_id whitelist[] __initconst = {
>  	{ .compatible = "hisilicon,hi3660", },
>  
>  	{ .compatible = "fsl,imx27", },
>  	{ .compatible = "fsl,imx51", },
>  	{ .compatible = "fsl,imx53", },
> -	{ .compatible = "fsl,imx7d", },
>  
>  	{ .compatible = "marvell,berlin", },
>  	{ .compatible = "marvell,pxa250", },
>  	{ .compatible = "marvell,pxa270", },
>  
> @@ -106,10 +105,11 @@ static const struct of_device_id whitelist[] __initconst = {
>   */
>  static const struct of_device_id blacklist[] __initconst = {
>  	{ .compatible = "calxeda,highbank", },
>  	{ .compatible = "calxeda,ecx-2000", },
>  
> +	{ .compatible = "fsl,imx7d", },
>  	{ .compatible = "fsl,imx8mq", },
>  	{ .compatible = "fsl,imx8mm", },
>  
>  	{ .compatible = "marvell,armadaxp", },
>  
> diff --git a/drivers/cpufreq/imx-cpufreq-dt.c b/drivers/cpufreq/imx-cpufreq-dt.c
> index 5061503cb0a1..ce26ffc18ce6 100644
> --- a/drivers/cpufreq/imx-cpufreq-dt.c
> +++ b/drivers/cpufreq/imx-cpufreq-dt.c
> @@ -18,10 +18,11 @@
>  #define OCOTP_CFG3_SPEED_GRADE_MASK	(0x3 << 8)
>  #define OCOTP_CFG3_MKT_SEGMENT_SHIFT    6
>  #define OCOTP_CFG3_MKT_SEGMENT_MASK     (0x3 << 6)
>  
>  static const struct of_device_id imx_cpufreq_dt_match_list[] = {
> +	{ .compatible = "fsl,imx7d" },
>  	{ .compatible = "fsl,imx8mm" },
>  	{ .compatible = "fsl,imx8mq" },
>  	{}
>  };

What is the purpose of this array and can we get rid of it instead ? I am asking
as this driver gets probed only if the platform code has created the
imx-cpufreq-dt device and it shouldn't get created for other machines than what
is supported.

-- 
viresh

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH 3/3] cpufreq: Switch imx7d to imx-cpufreq-dt for speed grading
  2019-06-03  5:38   ` Viresh Kumar
@ 2019-06-03  7:01     ` Leonard Crestez
  2019-06-03  7:11       ` Viresh Kumar
  0 siblings, 1 reply; 6+ messages in thread
From: Leonard Crestez @ 2019-06-03  7:01 UTC (permalink / raw)
  To: Viresh Kumar
  Cc: Aisheng Dong, Jacky Bai, Anson Huang, linux-pm,
	Rafael J. Wysocki, dl-linux-imx, kernel, Fabio Estevam,
	Shawn Guo, linux-arm-kernel, Abel Vesa

On 6/3/2019 8:39 AM, Viresh Kumar wrote:
> On 29-05-19, 12:03, Leonard Crestez wrote:
>> This driver can handle speed grading bits on imx7d just like on imx8mq
>> and imx8mm.
>>
>> diff --git a/drivers/cpufreq/imx-cpufreq-dt.c b/drivers/cpufreq/imx-cpufreq-dt.c
>> index 5061503cb0a1..ce26ffc18ce6 100644
>> --- a/drivers/cpufreq/imx-cpufreq-dt.c
>> +++ b/drivers/cpufreq/imx-cpufreq-dt.c
>> @@ -18,10 +18,11 @@
>>   #define OCOTP_CFG3_SPEED_GRADE_MASK	(0x3 << 8)
>>   #define OCOTP_CFG3_MKT_SEGMENT_SHIFT    6
>>   #define OCOTP_CFG3_MKT_SEGMENT_MASK     (0x3 << 6)
>>   
>>   static const struct of_device_id imx_cpufreq_dt_match_list[] = {
>> +	{ .compatible = "fsl,imx7d" },
>>   	{ .compatible = "fsl,imx8mm" },
>>   	{ .compatible = "fsl,imx8mq" }, >>   	{}
>>   };
> 
> What is the purpose of this array and can we get rid of it instead ? I am asking
> as this driver gets probed only if the platform code has created the
> imx-cpufreq-dt device and it shouldn't get created for other machines than what
> is supported.

Maybe it will be useful in the future to add .data here if a chip starts 
using 3 speed grading bits?

It can be removed for now.

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH 3/3] cpufreq: Switch imx7d to imx-cpufreq-dt for speed grading
  2019-06-03  7:01     ` Leonard Crestez
@ 2019-06-03  7:11       ` Viresh Kumar
  0 siblings, 0 replies; 6+ messages in thread
From: Viresh Kumar @ 2019-06-03  7:11 UTC (permalink / raw)
  To: Leonard Crestez
  Cc: Aisheng Dong, Jacky Bai, Anson Huang, linux-pm,
	Rafael J. Wysocki, dl-linux-imx, kernel, Fabio Estevam,
	Shawn Guo, linux-arm-kernel, Abel Vesa

On 03-06-19, 07:01, Leonard Crestez wrote:
> On 6/3/2019 8:39 AM, Viresh Kumar wrote:
> > On 29-05-19, 12:03, Leonard Crestez wrote:
> >> This driver can handle speed grading bits on imx7d just like on imx8mq
> >> and imx8mm.
> >>
> >> diff --git a/drivers/cpufreq/imx-cpufreq-dt.c b/drivers/cpufreq/imx-cpufreq-dt.c
> >> index 5061503cb0a1..ce26ffc18ce6 100644
> >> --- a/drivers/cpufreq/imx-cpufreq-dt.c
> >> +++ b/drivers/cpufreq/imx-cpufreq-dt.c
> >> @@ -18,10 +18,11 @@
> >>   #define OCOTP_CFG3_SPEED_GRADE_MASK	(0x3 << 8)
> >>   #define OCOTP_CFG3_MKT_SEGMENT_SHIFT    6
> >>   #define OCOTP_CFG3_MKT_SEGMENT_MASK     (0x3 << 6)
> >>   
> >>   static const struct of_device_id imx_cpufreq_dt_match_list[] = {
> >> +	{ .compatible = "fsl,imx7d" },
> >>   	{ .compatible = "fsl,imx8mm" },
> >>   	{ .compatible = "fsl,imx8mq" }, >>   	{}
> >>   };
> > 
> > What is the purpose of this array and can we get rid of it instead ? I am asking
> > as this driver gets probed only if the platform code has created the
> > imx-cpufreq-dt device and it shouldn't get created for other machines than what
> > is supported.
> 
> Maybe it will be useful in the future to add .data here if a chip starts 
> using 3 speed grading bits?
> 
> It can be removed for now.

Yep, please remove it then for now. And it would be better to break the current
patch into arch and cpufreq part, so I can apply only the cpufreq parts easily.

-- 
viresh

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

end of thread, other threads:[~2019-06-03  7:11 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-29 12:03 [PATCH 1/3] ARM: dts: imx7d: Update cpufreq OPP table Leonard Crestez
2019-05-29 12:03 ` [PATCH 2/3] ARM: imx_v6_v7_defconfig: Enable CONFIG_ARM_IMX_CPUFREQ_DT Leonard Crestez
2019-05-29 12:03 ` [PATCH 3/3] cpufreq: Switch imx7d to imx-cpufreq-dt for speed grading Leonard Crestez
2019-06-03  5:38   ` Viresh Kumar
2019-06-03  7:01     ` Leonard Crestez
2019-06-03  7:11       ` Viresh Kumar

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).