Skip to contentSkip to conversation

OMAP2+: use control module mfd driver in omap_type

PATCH Superseded Konstantin Baydarov 2 participants 3 messages Jun 27, 2012 – Aug 8, 2012

Subsystems (3)

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH v3 3/7 OMAP2+: use control module mfd driver in omap_type

OMAP system control module can be probed early, then omap_type is safe to use its APIs.

TODO: add support for other omap versions

---
 arch/arm/mach-omap2/id.c |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)
arch/arm/mach-omap2/id.c +5 -4
index 00486a8..1b0cec8 100644
@@ -18,6 +18,7 @@
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/io.h>
+#include <linux/mfd/omap_control.h>
 
 #include <asm/cputype.h>
 
@@ -43,13 +44,13 @@ int omap_type(void)
 	u32 val = 0;
 
 	if (cpu_is_omap24xx()) {
-		val = omap_ctrl_readl(OMAP24XX_CONTROL_STATUS);
+		val = omap_control_status_read(OMAP24XX_CONTROL_STATUS);
 	} else if (cpu_is_am33xx()) {
-		val = omap_ctrl_readl(AM33XX_CONTROL_STATUS);
+		val = omap_control_status_read(AM33XX_CONTROL_STATUS);
 	} else if (cpu_is_omap34xx()) {
-		val = omap_ctrl_readl(OMAP343X_CONTROL_STATUS);
+		val = omap_control_status_read(OMAP343X_CONTROL_STATUS);
 	} else if (cpu_is_omap44xx()) {
-		val = omap_ctrl_readl(OMAP4_CTRL_MODULE_CORE_STATUS);
+		val = omap_control_status_read(OMAP4_CTRL_MODULE_CORE_STATUS);
 	} else {
 		pr_err("Cannot detect omap type!\n");
 		goto out;
Signature · 1 line
1.7.7.6
maintainer
#1 lore raw

PATCH v3 3/7 OMAP2+: use control module mfd driver in omap_type

Hi,

Quoted 30 lines · Konstantin Baydarov

OMAP system control module can be probed early, then omap_type is safe to use its APIs.

TODO: add support for other omap versions

---
 arch/arm/mach-omap2/id.c |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)
arch/arm/mach-omap2/id.c +2 -2
index 00486a8..1b0cec8 100644
@@ -18,6 +18,7 @@
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/io.h>
+#include <linux/mfd/omap_control.h>
 
 #include <asm/cputype.h>
 
@@ -43,13 +44,13 @@ int omap_type(void)
 	u32 val = 0;
 
 	if (cpu_is_omap24xx()) {
-		val = omap_ctrl_readl(OMAP24XX_CONTROL_STATUS);
+		val = omap_control_status_read(OMAP24XX_CONTROL_STATUS);
 	} else if (cpu_is_am33xx()) {
-		val = omap_ctrl_readl(AM33XX_CONTROL_STATUS);

arch/arm/mach-omap2/id.c int omap_type(void) · line 56

Quoted 10 lines
arch/arm/mach-omap2/id.c +3 -2
+		val = omap_control_status_read(AM33XX_CONTROL_STATUS);
 	} else if (cpu_is_omap34xx()) {
-		val = omap_ctrl_readl(OMAP343X_CONTROL_STATUS);
+		val = omap_control_status_read(OMAP343X_CONTROL_STATUS);
 	} else if (cpu_is_omap44xx()) {
-		val = omap_ctrl_readl(OMAP4_CTRL_MODULE_CORE_STATUS);
+		val = omap_control_status_read(OMAP4_CTRL_MODULE_CORE_STATUS);
 	} else {
 		pr_err("Cannot detect omap type!\n");
 		goto out;

I think you should keep the CONTROL_STATUS defines private to the SCM core driver, there should be no need to pass it here. Just make it int omap_control_status_read(void).

Of course that means that the SCM core is initialized to some extent to know where to find the CONTROL_STATUS register. That should probably be done as part of the set_globals calls done in init_early in mach-omap2/io.c file.

Regards,

Tony

maintainer
#2 lore raw

PATCH v3 3/7 OMAP2+: use control module mfd driver in omap_type

In reply to Konstantin Baydarov
Quoted 18 lines · Konstantin Baydarov
arch/arm/mach-omap2/id.c +2 -2
@@ -18,6 +18,7 @@
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/io.h>
+#include <linux/mfd/omap_control.h>
 
 #include <asm/cputype.h>
 
@@ -43,13 +44,13 @@ int omap_type(void)
 	u32 val = 0;
 
 	if (cpu_is_omap24xx()) {
-		val = omap_ctrl_readl(OMAP24XX_CONTROL_STATUS);
+		val = omap_control_status_read(OMAP24XX_CONTROL_STATUS);
 	} else if (cpu_is_am33xx()) {
-		val = omap_ctrl_readl(AM33XX_CONTROL_STATUS);

arch/arm/mach-omap2/id.c int omap_type(void) · line 56

Quoted 10 lines
arch/arm/mach-omap2/id.c +3 -2
+		val = omap_control_status_read(AM33XX_CONTROL_STATUS);
 	} else if (cpu_is_omap34xx()) {
-		val = omap_ctrl_readl(OMAP343X_CONTROL_STATUS);
+		val = omap_control_status_read(OMAP343X_CONTROL_STATUS);
 	} else if (cpu_is_omap44xx()) {
-		val = omap_ctrl_readl(OMAP4_CTRL_MODULE_CORE_STATUS);
+		val = omap_control_status_read(OMAP4_CTRL_MODULE_CORE_STATUS);
 	} else {
 		pr_err("Cannot detect omap type!\n");
 		goto out;

I think I already commented on this.. This needs to become just:

val = omap_control_status_read();

with no need to pass the status register as a parameter.

Regards,

Tony