diff mbox series

[3/3] cpufreq: Switch imx7d to imx-cpufreq-dt for speed grading

Message ID 8787934ff35e7e55837f2caabc0d5bf65828d971.1559131365.git.leonard.crestez@nxp.com (mailing list archive)
State Superseded, archived
Headers show
Series [1/3] ARM: dts: imx7d: Update cpufreq OPP table | expand

Commit Message

Leonard Crestez May 29, 2019, 12:03 p.m. UTC
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(-)

Comments

Viresh Kumar June 3, 2019, 5:38 a.m. UTC | #1
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.
Leonard Crestez June 3, 2019, 7:01 a.m. UTC | #2
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.
Viresh Kumar June 3, 2019, 7:11 a.m. UTC | #3
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.
diff mbox series

Patch

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" },
 	{}
 };