RE: [PATCHv4 1/8] OMAP3: Clockdomain: Added API for checking if HWSUP is enabled

2010-02-02 Thread Tero.Kristo
 

-Original Message-
From: ext Paul Walmsley [mailto:p...@pwsan.com] 
Sent: 02 February, 2010 00:11
To: Kristo Tero (Nokia-D/Tampere)
Cc: linux-omap@vger.kernel.org
Subject: Re: [PATCHv4 1/8] OMAP3: Clockdomain: Added API for 
checking if HWSUP is enabled

Hi Tero,

On Fri, 22 Jan 2010, Tero Kristo wrote:

 From: Tero Kristo tero.kri...@nokia.com
 
 omap2_clkdm_get_hwsup(clkdm) can be used to check if automatic HW
 transitions for the domain are enabled or not. This is needed for the
 powerdomain code that adds support for INACTIVE state, as it needs to
 disable HWSUP on the fly for ON state, and re-enable it 
after returning
 to some other state.
 
 Signed-off-by: Tero Kristo tero.kri...@nokia.com

An updated patch with some revisions is below.  Please let me know if 
there's something that still should be changed.  The revisions are:

Your changes look okay to me.


1. Split the if-statement expressions up into separate lines per 
CodingStyle

2. Rename omap2_clkdm_get_hwsup() to omap2_clkdm_read_hwsup() 
to follow 
the general practice in this file and powerdomain.c that 
functions with 
'_get_' in the name read configuration data, and functions 
with '_read_' 
read from the hardware (or a cache of the hardware register)

3. Add OMAP4 support

4. Added the extra asterisk in the comment body to indicate 
kerneldoc-format comment

5. Updated patch to apply after the current round of 2.6.34 changes


regards,

- Paul

From fc2f8ad184e012a5574e1110c359354d247a1709 Mon Sep 17 00:00:00 2001
From: Tero Kristo tero.kri...@nokia.com
Date: Mon, 1 Feb 2010 13:41:26 -0700
Subject: [PATCH] OMAP3: Clockdomain: Added API for checking if 
HWSUP is enabled

omap2_clkdm_read_hwsup(clkdm) can be used to check if automatic HW
transitions for the domain are enabled or not. This is needed for the
powerdomain code that adds support for INACTIVE state, as it needs to
disable HWSUP on the fly for ON state, and re-enable it after returning
to some other state.

Signed-off-by: Tero Kristo tero.kri...@nokia.com
[p...@pwsan.com: added kerneldoc comment magic start; changed function
 name to omap2_clkdm_read_hwsup(); broke up expressions in function
 body; added OMAP4 support]
Signed-off-by: Paul Walmsley p...@pwsan.com
---
 arch/arm/mach-omap2/clockdomain.c |   30 
+
 arch/arm/plat-omap/include/plat/clockdomain.h |1 +
 2 files changed, 31 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/clockdomain.c 
b/arch/arm/mach-omap2/clockdomain.c
index a38a615..8dce3c9 100644
--- a/arch/arm/mach-omap2/clockdomain.c
+++ b/arch/arm/mach-omap2/clockdomain.c
@@ -868,6 +868,36 @@ int omap2_clkdm_wakeup(struct clockdomain *clkdm)
 }
 
 /**
+ * omap2_clkdm_read_hwsup - read the hwsup idle transition bit
+ * @clkdm: struct clockdomain *
+ *
+ * Checks whether hardware is allowed to switch the clockdomain @clkdm
+ * automatically into active or idle states. Returns -EINVAL if @clkdm
+ * is NULL; otherwise, 1 if hardware auto-idle is enabled, 0 if not.
+ */
+int omap2_clkdm_read_hwsup(struct clockdomain *clkdm)
+{
+  u32 u, v;
+
+  if (!clkdm)
+  return -EINVAL;
+
+  u = cm_read_mod_reg(clkdm-pwrdm.ptr-prcm_offs, CM_CLKSTCTRL);
+  u = clkdm-clktrctrl_mask;
+
+  if (cpu_is_omap24xx())
+  v = OMAP24XX_CLKSTCTRL_ENABLE_AUTO;
+  else if (cpu_is_omap34xx() || cpu_is_omap44xx())
+  v = OMAP34XX_CLKSTCTRL_ENABLE_AUTO;
+  else
+  BUG();
+
+  v = __ffs(clkdm-clktrctrl_mask);
+
+  return (u == v) ? 1 : 0;
+}
+
+/**
  * omap2_clkdm_allow_idle - enable hwsup idle transitions for clkdm
  * @clkdm: struct clockdomain *
  *
diff --git a/arch/arm/plat-omap/include/plat/clockdomain.h 
b/arch/arm/plat-omap/include/plat/clockdomain.h
index ba0a6c0..9d25f4e 100644
--- a/arch/arm/plat-omap/include/plat/clockdomain.h
+++ b/arch/arm/plat-omap/include/plat/clockdomain.h
@@ -129,6 +129,7 @@ int clkdm_del_sleepdep(struct clockdomain 
*clkdm1, struct clockdomain *clkdm2);
 int clkdm_read_sleepdep(struct clockdomain *clkdm1, struct 
clockdomain *clkdm2);
 int clkdm_clear_all_sleepdeps(struct clockdomain *clkdm);
 
+int omap2_clkdm_read_hwsup(struct clockdomain *clkdm);
 void omap2_clkdm_allow_idle(struct clockdomain *clkdm);
 void omap2_clkdm_deny_idle(struct clockdomain *clkdm);
 
-- 
1.6.6.rc2.5.g49666

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCHv4 1/8] OMAP3: Clockdomain: Added API for checking if HWSUP is enabled

2010-02-01 Thread Paul Walmsley
Hi Tero,

On Fri, 22 Jan 2010, Tero Kristo wrote:

 From: Tero Kristo tero.kri...@nokia.com
 
 omap2_clkdm_get_hwsup(clkdm) can be used to check if automatic HW
 transitions for the domain are enabled or not. This is needed for the
 powerdomain code that adds support for INACTIVE state, as it needs to
 disable HWSUP on the fly for ON state, and re-enable it after returning
 to some other state.
 
 Signed-off-by: Tero Kristo tero.kri...@nokia.com

An updated patch with some revisions is below.  Please let me know if 
there's something that still should be changed.  The revisions are:

1. Split the if-statement expressions up into separate lines per 
CodingStyle

2. Rename omap2_clkdm_get_hwsup() to omap2_clkdm_read_hwsup() to follow 
the general practice in this file and powerdomain.c that functions with 
'_get_' in the name read configuration data, and functions with '_read_' 
read from the hardware (or a cache of the hardware register)

3. Add OMAP4 support

4. Added the extra asterisk in the comment body to indicate 
kerneldoc-format comment

5. Updated patch to apply after the current round of 2.6.34 changes


regards,

- Paul

From fc2f8ad184e012a5574e1110c359354d247a1709 Mon Sep 17 00:00:00 2001
From: Tero Kristo tero.kri...@nokia.com
Date: Mon, 1 Feb 2010 13:41:26 -0700
Subject: [PATCH] OMAP3: Clockdomain: Added API for checking if HWSUP is enabled

omap2_clkdm_read_hwsup(clkdm) can be used to check if automatic HW
transitions for the domain are enabled or not. This is needed for the
powerdomain code that adds support for INACTIVE state, as it needs to
disable HWSUP on the fly for ON state, and re-enable it after returning
to some other state.

Signed-off-by: Tero Kristo tero.kri...@nokia.com
[p...@pwsan.com: added kerneldoc comment magic start; changed function
 name to omap2_clkdm_read_hwsup(); broke up expressions in function
 body; added OMAP4 support]
Signed-off-by: Paul Walmsley p...@pwsan.com
---
 arch/arm/mach-omap2/clockdomain.c |   30 +
 arch/arm/plat-omap/include/plat/clockdomain.h |1 +
 2 files changed, 31 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/clockdomain.c 
b/arch/arm/mach-omap2/clockdomain.c
index a38a615..8dce3c9 100644
--- a/arch/arm/mach-omap2/clockdomain.c
+++ b/arch/arm/mach-omap2/clockdomain.c
@@ -868,6 +868,36 @@ int omap2_clkdm_wakeup(struct clockdomain *clkdm)
 }
 
 /**
+ * omap2_clkdm_read_hwsup - read the hwsup idle transition bit
+ * @clkdm: struct clockdomain *
+ *
+ * Checks whether hardware is allowed to switch the clockdomain @clkdm
+ * automatically into active or idle states. Returns -EINVAL if @clkdm
+ * is NULL; otherwise, 1 if hardware auto-idle is enabled, 0 if not.
+ */
+int omap2_clkdm_read_hwsup(struct clockdomain *clkdm)
+{
+   u32 u, v;
+
+   if (!clkdm)
+   return -EINVAL;
+
+   u = cm_read_mod_reg(clkdm-pwrdm.ptr-prcm_offs, CM_CLKSTCTRL);
+   u = clkdm-clktrctrl_mask;
+
+   if (cpu_is_omap24xx())
+   v = OMAP24XX_CLKSTCTRL_ENABLE_AUTO;
+   else if (cpu_is_omap34xx() || cpu_is_omap44xx())
+   v = OMAP34XX_CLKSTCTRL_ENABLE_AUTO;
+   else
+   BUG();
+
+   v = __ffs(clkdm-clktrctrl_mask);
+
+   return (u == v) ? 1 : 0;
+}
+
+/**
  * omap2_clkdm_allow_idle - enable hwsup idle transitions for clkdm
  * @clkdm: struct clockdomain *
  *
diff --git a/arch/arm/plat-omap/include/plat/clockdomain.h 
b/arch/arm/plat-omap/include/plat/clockdomain.h
index ba0a6c0..9d25f4e 100644
--- a/arch/arm/plat-omap/include/plat/clockdomain.h
+++ b/arch/arm/plat-omap/include/plat/clockdomain.h
@@ -129,6 +129,7 @@ int clkdm_del_sleepdep(struct clockdomain *clkdm1, struct 
clockdomain *clkdm2);
 int clkdm_read_sleepdep(struct clockdomain *clkdm1, struct clockdomain 
*clkdm2);
 int clkdm_clear_all_sleepdeps(struct clockdomain *clkdm);
 
+int omap2_clkdm_read_hwsup(struct clockdomain *clkdm);
 void omap2_clkdm_allow_idle(struct clockdomain *clkdm);
 void omap2_clkdm_deny_idle(struct clockdomain *clkdm);
 
-- 
1.6.6.rc2.5.g49666

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCHv4 1/8] OMAP3: Clockdomain: Added API for checking if HWSUP is enabled

2010-01-22 Thread Tero Kristo
From: Tero Kristo tero.kri...@nokia.com

omap2_clkdm_get_hwsup(clkdm) can be used to check if automatic HW
transitions for the domain are enabled or not. This is needed for the
powerdomain code that adds support for INACTIVE state, as it needs to
disable HWSUP on the fly for ON state, and re-enable it after returning
to some other state.

Signed-off-by: Tero Kristo tero.kri...@nokia.com
---
 arch/arm/mach-omap2/clockdomain.c |   27 +
 arch/arm/plat-omap/include/plat/clockdomain.h |1 +
 2 files changed, 28 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/clockdomain.c 
b/arch/arm/mach-omap2/clockdomain.c
index dd285f0..728d1b0 100644
--- a/arch/arm/mach-omap2/clockdomain.c
+++ b/arch/arm/mach-omap2/clockdomain.c
@@ -472,6 +472,33 @@ int omap2_clkdm_wakeup(struct clockdomain *clkdm)
return 0;
 }
 
+/*
+ * omap2_clkdm_get_hwsup - get the hwsup idle transition bit
+ * @clkdm: struct clockdomain *
+ *
+ * Checks whether hardware is allowed to switch the clockdomain
+ * automatically into active or idle states. Returns 1 if yes,
+ * 0 otherwise.
+ */
+int omap2_clkdm_get_hwsup(struct clockdomain *clkdm)
+{
+   u32 v;
+
+   if (cpu_is_omap24xx())
+   v = OMAP24XX_CLKSTCTRL_ENABLE_AUTO;
+   else if (cpu_is_omap34xx())
+   v = OMAP34XX_CLKSTCTRL_ENABLE_AUTO;
+   else
+   BUG();
+
+   if ((cm_read_mod_reg(clkdm-pwrdm.ptr-prcm_offs, CM_CLKSTCTRL) 
+   clkdm-clktrctrl_mask) ==
+   (v  __ffs(clkdm-clktrctrl_mask)))
+   return 1;
+
+   return 0;
+}
+
 /**
  * omap2_clkdm_allow_idle - enable hwsup idle transitions for clkdm
  * @clkdm: struct clockdomain *
diff --git a/arch/arm/plat-omap/include/plat/clockdomain.h 
b/arch/arm/plat-omap/include/plat/clockdomain.h
index eb73482..9127459 100644
--- a/arch/arm/plat-omap/include/plat/clockdomain.h
+++ b/arch/arm/plat-omap/include/plat/clockdomain.h
@@ -99,6 +99,7 @@ int clkdm_for_each(int (*fn)(struct clockdomain *clkdm, void 
*user),
void *user);
 struct powerdomain *clkdm_get_pwrdm(struct clockdomain *clkdm);
 
+int omap2_clkdm_get_hwsup(struct clockdomain *clkdm);
 void omap2_clkdm_allow_idle(struct clockdomain *clkdm);
 void omap2_clkdm_deny_idle(struct clockdomain *clkdm);
 
-- 
1.5.4.3

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html