Skip to contentSkip to conversation

ARM: zynq: cpuidle: convert to platform driver

RFC PATCH New Daniel Lezcano 2 participants 4 messages Sep 26, 2013 – Sep 27, 2013

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 ARM: zynq: cpuidle: convert to platform driver

As the ux500 and the kirkwood driver, make the zynq driver a platform driver

---
 arch/arm/mach-zynq/common.c    |    7 +++++++
 drivers/cpuidle/cpuidle-zynq.c |   15 ++++++++++-----
 2 files changed, 17 insertions(+), 5 deletions(-)
arch/arm/mach-zynq/common.c +7 -0
index 5f25256..0f0d88f 100644
@@ -44,6 +44,10 @@ static struct of_device_id zynq_of_bus_ids[] __initdata = {
 	{}
 };
 
+static struct platform_device zynq_cpuidle_device = {
+	.name = "cpuidle-zynq",
+};
+
 /**
  * zynq_init_machine - System specific initialization, intended to be
  *		       called from board specific initialization.
@@ -56,6 +60,9 @@ static void __init zynq_init_machine(void)
 	l2x0_of_init(0x02060000, 0xF0F0FFFF);
 
 	of_platform_bus_probe(NULL, zynq_of_bus_ids, NULL);
+
+	if (of_machine_is_compatible("xlnx,zynq-7000"))
+		platform_device_register(&zynq_cpuidle_device);
 }
 
 static void __init zynq_timer_init(void)
drivers/cpuidle/cpuidle-zynq.c +10 -5
index 38e03a1..c8bd261 100644
@@ -70,14 +70,19 @@ static struct cpuidle_driver zynq_idle_driver = {
 };
 
 /* Initialize CPU idle by registering the idle states */
-static int __init zynq_cpuidle_init(void)
+static int __init zynq_cpuidle_probe(void)
 {
-	if (!of_machine_is_compatible("xlnx,zynq-7000"))
-		return -ENODEV;
-
 	pr_info("Xilinx Zynq CpuIdle Driver started\n");
 
 	return cpuidle_register(&zynq_idle_driver, NULL);
 }
 
-device_initcall(zynq_cpuidle_init);
+static struct platform_driver zynq_cpuidle_driver = {
+	.driver = {
+		.name = "cpuidle-zynq",
+		.owner = THIS_MODULE,
+	},
+	.probe = zynq_cpuidle_probe,
+};
+
+module_platform_driver(zynq_cpuidle_driver);
Signature · 1 line
1.7.9.5
#1 lore raw

RFC PATCH 1/1 ARM: zynq: cpuidle: convert to platform driver

Hi Daniel,

Quoted 24 lines · Daniel Lezcano

As the ux500 and the kirkwood driver, make the zynq driver a platform driver

---
 arch/arm/mach-zynq/common.c    |    7 +++++++
 drivers/cpuidle/cpuidle-zynq.c |   15 ++++++++++-----
 2 files changed, 17 insertions(+), 5 deletions(-)
arch/arm/mach-zynq/common.c +4 -0
index 5f25256..0f0d88f 100644
@@ -44,6 +44,10 @@ static struct of_device_id zynq_of_bus_ids[] __initdata = {
 	{}
 };
 
+static struct platform_device zynq_cpuidle_device = {
+	.name = "cpuidle-zynq",
+};
+
 /**
  * zynq_init_machine - System specific initialization, intended to be
  *		       called from board specific initialization.

arch/arm/mach-zynq/common.c static void __init zynq_init_machine(void) · line 64

Quoted 5 lines
arch/arm/mach-zynq/common.c +2 -0
@@ -56,6 +60,9 @@ static void __init zynq_init_machine(void)
 	l2x0_of_init(0x02060000, 0xF0F0FFFF);
 
 	of_platform_bus_probe(NULL, zynq_of_bus_ids, NULL);
+
+	if (of_machine_is_compatible("xlnx,zynq-7000"))

This is not needed because all zynq platforms have this compatibility string and there is no any other clone.

The rest is fine.

Thanks,
Michal

#2 lore raw

RFC PATCH 1/1 ARM: zynq: cpuidle: convert to platform driver

Quoted 29 lines · Michal Simek

Hi Daniel,

Quoted 26 lines · Daniel Lezcano

As the ux500 and the kirkwood driver, make the zynq driver a platform driver

---
  arch/arm/mach-zynq/common.c    |    7 +++++++
  drivers/cpuidle/cpuidle-zynq.c |   15 ++++++++++-----
  2 files changed, 17 insertions(+), 5 deletions(-)
arch/arm/mach-zynq/common.c +4 -0
index 5f25256..0f0d88f 100644
@@ -44,6 +44,10 @@ static struct of_device_id zynq_of_bus_ids[] __initdata = {
  	{}
  };
 
+static struct platform_device zynq_cpuidle_device = {
+	.name = "cpuidle-zynq",
+};
+
  /**
   * zynq_init_machine - System specific initialization, intended to be
   *		       called from board specific initialization.
@@ -56,6 +60,9 @@ static void __init zynq_init_machine(void)
  	l2x0_of_init(0x02060000, 0xF0F0FFFF);
 
Quoted 6 lines

arch/arm/mach-zynq/common.c static void __init zynq_init_machine(void) · line 64

Quoted 3 lines
arch/arm/mach-zynq/common.c +2 -0
  	of_platform_bus_probe(NULL, zynq_of_bus_ids, NULL);
+
+	if (of_machine_is_compatible("xlnx,zynq-7000"))

This is not needed because all zynq platforms have this compatibility string and there is no any other clone.

Ah, ok. So it is not needed in the current code. I will write its removal in a separate patch.

Thanks
-- Daniel

Signature · 5 lines
  <http://www.linaro.org/> Linaro.org ? Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog
#3 lore raw

RFC PATCH 1/1 ARM: zynq: cpuidle: convert to platform driver

Quoted 30 lines · Daniel Lezcano
Quoted 29 lines · Michal Simek

Hi Daniel,

Quoted 26 lines · Daniel Lezcano

As the ux500 and the kirkwood driver, make the zynq driver a platform driver

---
  arch/arm/mach-zynq/common.c    |    7 +++++++
  drivers/cpuidle/cpuidle-zynq.c |   15 ++++++++++-----
  2 files changed, 17 insertions(+), 5 deletions(-)
arch/arm/mach-zynq/common.c +4 -0
index 5f25256..0f0d88f 100644
@@ -44,6 +44,10 @@ static struct of_device_id zynq_of_bus_ids[] __initdata = {
      {}
  };
 
+static struct platform_device zynq_cpuidle_device = {
+    .name = "cpuidle-zynq",
+};
+
  /**
   * zynq_init_machine - System specific initialization, intended to be
   *               called from board specific initialization.
@@ -56,6 +60,9 @@ static void __init zynq_init_machine(void)
      l2x0_of_init(0x02060000, 0xF0F0FFFF);
 
Quoted 8 lines
Quoted 6 lines

arch/arm/mach-zynq/common.c static void __init zynq_init_machine(void) · line 64

Quoted 3 lines
arch/arm/mach-zynq/common.c +2 -0
      of_platform_bus_probe(NULL, zynq_of_bus_ids, NULL);
+
+    if (of_machine_is_compatible("xlnx,zynq-7000"))

This is not needed because all zynq platforms have this compatibility string and there is no any other clone.

Ah, ok. So it is not needed in the current code. I will write its removal in a separate patch.

ok. Thanks.
Feel free to give there my ACK too.

Thanks,
Michal