All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/4] ARM: OMAP3PLUS PM: Add IO Daisychain support via hwmod mux
@ 2011-10-04 17:52 ` Vishwanath BS
  0 siblings, 0 replies; 24+ messages in thread
From: Vishwanath BS @ 2011-10-04 17:52 UTC (permalink / raw)
  To: linux-omap; +Cc: khilman, linux-arm-kernel, Vishwanath BS

The folowing patch series provides IO Daisychain feature via omap hwmod mux
framework.

The patch series has been generated against 3.1 rc4 and tested on OMAP3 Platform
(ZOOM3) for Retention and OFF mode in suspend/cpuidle path.

Also tested against latest UART Runtime with Chain Handler patches [1].

[1]: git://gitorious.org/runtime_3-0/runtime_3-0.git v6_uart_runtime

Rajendra Nayak (1):
  OMAP4 PM: Add IO Daisychain support

Vishwanath BS (3):
  OMAP3 PM: Fix IO Daisychain sequence
  OMAP3 PM: Enable IO Wake up
  OMAP3PLUS PM: Add IO Daisychain support via hwmod mux

 arch/arm/mach-omap2/omap_hwmod.c |    9 +++++++--
 arch/arm/mach-omap2/pm.c         |    9 +++++++++
 arch/arm/mach-omap2/pm.h         |    3 +++
 arch/arm/mach-omap2/pm34xx.c     |   33 +++++++--------------------------
 arch/arm/mach-omap2/pm44xx.c     |   36 ++++++++++++++++++++++++++++++++++++
 5 files changed, 62 insertions(+), 28 deletions(-)


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

* [PATCH 0/4] ARM: OMAP3PLUS PM: Add IO Daisychain support via hwmod mux
@ 2011-10-04 17:52 ` Vishwanath BS
  0 siblings, 0 replies; 24+ messages in thread
From: Vishwanath BS @ 2011-10-04 17:52 UTC (permalink / raw)
  To: linux-arm-kernel

The folowing patch series provides IO Daisychain feature via omap hwmod mux
framework.

The patch series has been generated against 3.1 rc4 and tested on OMAP3 Platform
(ZOOM3) for Retention and OFF mode in suspend/cpuidle path.

Also tested against latest UART Runtime with Chain Handler patches [1].

[1]: git://gitorious.org/runtime_3-0/runtime_3-0.git v6_uart_runtime

Rajendra Nayak (1):
  OMAP4 PM: Add IO Daisychain support

Vishwanath BS (3):
  OMAP3 PM: Fix IO Daisychain sequence
  OMAP3 PM: Enable IO Wake up
  OMAP3PLUS PM: Add IO Daisychain support via hwmod mux

 arch/arm/mach-omap2/omap_hwmod.c |    9 +++++++--
 arch/arm/mach-omap2/pm.c         |    9 +++++++++
 arch/arm/mach-omap2/pm.h         |    3 +++
 arch/arm/mach-omap2/pm34xx.c     |   33 +++++++--------------------------
 arch/arm/mach-omap2/pm44xx.c     |   36 ++++++++++++++++++++++++++++++++++++
 5 files changed, 62 insertions(+), 28 deletions(-)

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

* [PATCH 1/4] ARM: OMAP3 PM: Fix IO Daisychain sequence
  2011-10-04 17:52 ` Vishwanath BS
@ 2011-10-04 17:52   ` Vishwanath BS
  -1 siblings, 0 replies; 24+ messages in thread
From: Vishwanath BS @ 2011-10-04 17:52 UTC (permalink / raw)
  To: linux-omap; +Cc: khilman, linux-arm-kernel, Vishwanath BS

As per OMAP3630 TRM Section 3.5.7.2.2, the right sequence for enabling IO Daisy
chain is "The I/O wake-up scheme is enabled by triggering the I/O daisy chain
control (Wu clock) by programming a dedicated register
(PRCM.PM_WKEN_WKUP[16] EN_IO_CHAIN) in the PRCM module.Software must wait for
the I/O daisy chain to complete before it transitions the PER domain to a
nonfunctional state. This is done by polling a dedicated status bit in the PRCM
module (PRCM.PM_WKST_WKUP[16] ST_IO_CHAIN). This status bit must be cleared by
software when the bit is read to  1".

The original code was polling on a wrong register which is fixed in this patch.
Also omap3_enable_io_chain is made non static as it's going to be used in
subsequent patches.
 
Signed-off-by: Vishwanath BS <vishwanath.bs@ti.com>
---
 arch/arm/mach-omap2/pm.h     |    1 +
 arch/arm/mach-omap2/pm34xx.c |    6 +++---
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/arch/arm/mach-omap2/pm.h b/arch/arm/mach-omap2/pm.h
index 4e166ad..9a36a7c 100644
--- a/arch/arm/mach-omap2/pm.h
+++ b/arch/arm/mach-omap2/pm.h
@@ -21,6 +21,7 @@ extern void omap_sram_idle(void);
 extern int omap3_can_sleep(void);
 extern int omap_set_pwrdm_state(struct powerdomain *pwrdm, u32 state);
 extern int omap3_idle_init(void);
+extern void omap3_enable_io_chain(void);
 
 #if defined(CONFIG_PM_OPP)
 extern int omap3_opp_init(void);
diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c
index 7255d9b..61f1a5b 100644
--- a/arch/arm/mach-omap2/pm34xx.c
+++ b/arch/arm/mach-omap2/pm34xx.c
@@ -95,7 +95,7 @@ static inline void omap3_per_restore_context(void)
 	omap_gpio_restore_context();
 }
 
-static void omap3_enable_io_chain(void)
+void omap3_enable_io_chain(void)
 {
 	int timeout = 0;
 
@@ -105,7 +105,7 @@ static void omap3_enable_io_chain(void)
 		/* Do a readback to assure write has been done */
 		omap2_prm_read_mod_reg(WKUP_MOD, PM_WKEN);
 
-		while (!(omap2_prm_read_mod_reg(WKUP_MOD, PM_WKEN) &
+		while (!(omap2_prm_read_mod_reg(WKUP_MOD, PM_WKST) &
 			 OMAP3430_ST_IO_CHAIN_MASK)) {
 			timeout++;
 			if (timeout > 1000) {
@@ -114,7 +114,7 @@ static void omap3_enable_io_chain(void)
 				return;
 			}
 			omap2_prm_set_mod_reg_bits(OMAP3430_ST_IO_CHAIN_MASK,
-					     WKUP_MOD, PM_WKEN);
+					     WKUP_MOD, PM_WKST);
 		}
 	}
 }
-- 
1.7.0.4


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

* [PATCH 1/4] ARM: OMAP3 PM: Fix IO Daisychain sequence
@ 2011-10-04 17:52   ` Vishwanath BS
  0 siblings, 0 replies; 24+ messages in thread
From: Vishwanath BS @ 2011-10-04 17:52 UTC (permalink / raw)
  To: linux-arm-kernel

As per OMAP3630 TRM Section 3.5.7.2.2, the right sequence for enabling IO Daisy
chain is "The I/O wake-up scheme is enabled by triggering the I/O daisy chain
control (Wu clock) by programming a dedicated register
(PRCM.PM_WKEN_WKUP[16] EN_IO_CHAIN) in the PRCM module.Software must wait for
the I/O daisy chain to complete before it transitions the PER domain to a
nonfunctional state. This is done by polling a dedicated status bit in the PRCM
module (PRCM.PM_WKST_WKUP[16] ST_IO_CHAIN). This status bit must be cleared by
software when the bit is read to  1".

The original code was polling on a wrong register which is fixed in this patch.
Also omap3_enable_io_chain is made non static as it's going to be used in
subsequent patches.
 
Signed-off-by: Vishwanath BS <vishwanath.bs@ti.com>
---
 arch/arm/mach-omap2/pm.h     |    1 +
 arch/arm/mach-omap2/pm34xx.c |    6 +++---
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/arch/arm/mach-omap2/pm.h b/arch/arm/mach-omap2/pm.h
index 4e166ad..9a36a7c 100644
--- a/arch/arm/mach-omap2/pm.h
+++ b/arch/arm/mach-omap2/pm.h
@@ -21,6 +21,7 @@ extern void omap_sram_idle(void);
 extern int omap3_can_sleep(void);
 extern int omap_set_pwrdm_state(struct powerdomain *pwrdm, u32 state);
 extern int omap3_idle_init(void);
+extern void omap3_enable_io_chain(void);
 
 #if defined(CONFIG_PM_OPP)
 extern int omap3_opp_init(void);
diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c
index 7255d9b..61f1a5b 100644
--- a/arch/arm/mach-omap2/pm34xx.c
+++ b/arch/arm/mach-omap2/pm34xx.c
@@ -95,7 +95,7 @@ static inline void omap3_per_restore_context(void)
 	omap_gpio_restore_context();
 }
 
-static void omap3_enable_io_chain(void)
+void omap3_enable_io_chain(void)
 {
 	int timeout = 0;
 
@@ -105,7 +105,7 @@ static void omap3_enable_io_chain(void)
 		/* Do a readback to assure write has been done */
 		omap2_prm_read_mod_reg(WKUP_MOD, PM_WKEN);
 
-		while (!(omap2_prm_read_mod_reg(WKUP_MOD, PM_WKEN) &
+		while (!(omap2_prm_read_mod_reg(WKUP_MOD, PM_WKST) &
 			 OMAP3430_ST_IO_CHAIN_MASK)) {
 			timeout++;
 			if (timeout > 1000) {
@@ -114,7 +114,7 @@ static void omap3_enable_io_chain(void)
 				return;
 			}
 			omap2_prm_set_mod_reg_bits(OMAP3430_ST_IO_CHAIN_MASK,
-					     WKUP_MOD, PM_WKEN);
+					     WKUP_MOD, PM_WKST);
 		}
 	}
 }
-- 
1.7.0.4

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

* [PATCH 2/4] ARM: OMAP4 PM: Add IO Daisychain support
  2011-10-04 17:52 ` Vishwanath BS
@ 2011-10-04 17:52   ` Vishwanath BS
  -1 siblings, 0 replies; 24+ messages in thread
From: Vishwanath BS @ 2011-10-04 17:52 UTC (permalink / raw)
  To: linux-omap; +Cc: khilman, linux-arm-kernel, Rajendra Nayak, Vishwanath BS

From: Rajendra Nayak <rnayak@ti.com>

patch adds IO Daisychain support for OMAP4 as per section 3.9.4 in OMAP4430
Public TRM.

Signed-off-by: Rajendra Nayak <rnayak@ti.com>
Signed-off-by: Vishwanath BS <vishwanath.bs@ti.com>
---
 arch/arm/mach-omap2/pm.h     |    1 +
 arch/arm/mach-omap2/pm44xx.c |   36 ++++++++++++++++++++++++++++++++++++
 2 files changed, 37 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/pm.h b/arch/arm/mach-omap2/pm.h
index 9a36a7c..2e09d72 100644
--- a/arch/arm/mach-omap2/pm.h
+++ b/arch/arm/mach-omap2/pm.h
@@ -22,6 +22,7 @@ extern int omap3_can_sleep(void);
 extern int omap_set_pwrdm_state(struct powerdomain *pwrdm, u32 state);
 extern int omap3_idle_init(void);
 extern void omap3_enable_io_chain(void);
+extern void omap4_trigger_wuclk_ctrl(void);
 
 #if defined(CONFIG_PM_OPP)
 extern int omap3_opp_init(void);
diff --git a/arch/arm/mach-omap2/pm44xx.c b/arch/arm/mach-omap2/pm44xx.c
index 59a870b..aa7cff4 100644
--- a/arch/arm/mach-omap2/pm44xx.c
+++ b/arch/arm/mach-omap2/pm44xx.c
@@ -16,8 +16,17 @@
 #include <linux/err.h>
 #include <linux/slab.h>
 
+#include <plat/common.h>
+
 #include "powerdomain.h"
 #include <mach/omap4-common.h>
+#include "pm.h"
+#include "cm-regbits-44xx.h"
+#include "cminst44xx.h"
+#include "prm-regbits-44xx.h"
+#include "prcm44xx.h"
+#include "prm44xx.h"
+#include "prminst44xx.h"
 
 struct power_state {
 	struct powerdomain *pwrdm;
@@ -30,6 +39,33 @@ struct power_state {
 
 static LIST_HEAD(pwrst_list);
 
+#define MAX_IOPAD_LATCH_TIME 1000
+
+void omap4_trigger_wuclk_ctrl(void)
+{
+	int i = 0;
+
+	/* Enable GLOBAL_WUEN */
+	if (!omap4_cminst_read_inst_reg_bits(OMAP4430_PRM_PARTITION,
+			OMAP4430_PRM_DEVICE_INST, OMAP4_PRM_IO_PMCTRL_OFFSET,
+			OMAP4430_GLOBAL_WUEN_MASK))
+		omap4_prminst_rmw_inst_reg_bits(OMAP4430_GLOBAL_WUEN_MASK,
+			OMAP4430_GLOBAL_WUEN_MASK, OMAP4430_PRM_PARTITION,
+			OMAP4430_PRM_DEVICE_INST, OMAP4_PRM_IO_PMCTRL_OFFSET);
+
+	/* Trigger WUCLKIN enable */
+	omap4_prminst_rmw_inst_reg_bits(OMAP4430_WUCLK_CTRL_MASK, OMAP4430_WUCLK_CTRL_MASK,
+		OMAP4430_PRM_PARTITION, OMAP4430_PRM_DEVICE_INST, OMAP4_PRM_IO_PMCTRL_OFFSET);
+	omap_test_timeout(
+		((omap4_prminst_read_inst_reg(OMAP4430_PRM_PARTITION, OMAP4430_PRM_DEVICE_INST, OMAP4_PRM_IO_PMCTRL_OFFSET)
+		>> OMAP4430_WUCLK_STATUS_SHIFT) == 1),
+		MAX_IOPAD_LATCH_TIME, i);
+	/* Trigger WUCLKIN disable */
+	omap4_prminst_rmw_inst_reg_bits(OMAP4430_WUCLK_CTRL_MASK, 0x0,
+		OMAP4430_PRM_PARTITION, OMAP4430_PRM_DEVICE_INST, OMAP4_PRM_IO_PMCTRL_OFFSET);
+	return;
+}
+
 #ifdef CONFIG_SUSPEND
 static int omap4_pm_suspend(void)
 {
-- 
1.7.0.4


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

* [PATCH 2/4] ARM: OMAP4 PM: Add IO Daisychain support
@ 2011-10-04 17:52   ` Vishwanath BS
  0 siblings, 0 replies; 24+ messages in thread
From: Vishwanath BS @ 2011-10-04 17:52 UTC (permalink / raw)
  To: linux-arm-kernel

From: Rajendra Nayak <rnayak@ti.com>

patch adds IO Daisychain support for OMAP4 as per section 3.9.4 in OMAP4430
Public TRM.

Signed-off-by: Rajendra Nayak <rnayak@ti.com>
Signed-off-by: Vishwanath BS <vishwanath.bs@ti.com>
---
 arch/arm/mach-omap2/pm.h     |    1 +
 arch/arm/mach-omap2/pm44xx.c |   36 ++++++++++++++++++++++++++++++++++++
 2 files changed, 37 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/pm.h b/arch/arm/mach-omap2/pm.h
index 9a36a7c..2e09d72 100644
--- a/arch/arm/mach-omap2/pm.h
+++ b/arch/arm/mach-omap2/pm.h
@@ -22,6 +22,7 @@ extern int omap3_can_sleep(void);
 extern int omap_set_pwrdm_state(struct powerdomain *pwrdm, u32 state);
 extern int omap3_idle_init(void);
 extern void omap3_enable_io_chain(void);
+extern void omap4_trigger_wuclk_ctrl(void);
 
 #if defined(CONFIG_PM_OPP)
 extern int omap3_opp_init(void);
diff --git a/arch/arm/mach-omap2/pm44xx.c b/arch/arm/mach-omap2/pm44xx.c
index 59a870b..aa7cff4 100644
--- a/arch/arm/mach-omap2/pm44xx.c
+++ b/arch/arm/mach-omap2/pm44xx.c
@@ -16,8 +16,17 @@
 #include <linux/err.h>
 #include <linux/slab.h>
 
+#include <plat/common.h>
+
 #include "powerdomain.h"
 #include <mach/omap4-common.h>
+#include "pm.h"
+#include "cm-regbits-44xx.h"
+#include "cminst44xx.h"
+#include "prm-regbits-44xx.h"
+#include "prcm44xx.h"
+#include "prm44xx.h"
+#include "prminst44xx.h"
 
 struct power_state {
 	struct powerdomain *pwrdm;
@@ -30,6 +39,33 @@ struct power_state {
 
 static LIST_HEAD(pwrst_list);
 
+#define MAX_IOPAD_LATCH_TIME 1000
+
+void omap4_trigger_wuclk_ctrl(void)
+{
+	int i = 0;
+
+	/* Enable GLOBAL_WUEN */
+	if (!omap4_cminst_read_inst_reg_bits(OMAP4430_PRM_PARTITION,
+			OMAP4430_PRM_DEVICE_INST, OMAP4_PRM_IO_PMCTRL_OFFSET,
+			OMAP4430_GLOBAL_WUEN_MASK))
+		omap4_prminst_rmw_inst_reg_bits(OMAP4430_GLOBAL_WUEN_MASK,
+			OMAP4430_GLOBAL_WUEN_MASK, OMAP4430_PRM_PARTITION,
+			OMAP4430_PRM_DEVICE_INST, OMAP4_PRM_IO_PMCTRL_OFFSET);
+
+	/* Trigger WUCLKIN enable */
+	omap4_prminst_rmw_inst_reg_bits(OMAP4430_WUCLK_CTRL_MASK, OMAP4430_WUCLK_CTRL_MASK,
+		OMAP4430_PRM_PARTITION, OMAP4430_PRM_DEVICE_INST, OMAP4_PRM_IO_PMCTRL_OFFSET);
+	omap_test_timeout(
+		((omap4_prminst_read_inst_reg(OMAP4430_PRM_PARTITION, OMAP4430_PRM_DEVICE_INST, OMAP4_PRM_IO_PMCTRL_OFFSET)
+		>> OMAP4430_WUCLK_STATUS_SHIFT) == 1),
+		MAX_IOPAD_LATCH_TIME, i);
+	/* Trigger WUCLKIN disable */
+	omap4_prminst_rmw_inst_reg_bits(OMAP4430_WUCLK_CTRL_MASK, 0x0,
+		OMAP4430_PRM_PARTITION, OMAP4430_PRM_DEVICE_INST, OMAP4_PRM_IO_PMCTRL_OFFSET);
+	return;
+}
+
 #ifdef CONFIG_SUSPEND
 static int omap4_pm_suspend(void)
 {
-- 
1.7.0.4

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

* [PATCH 3/4] ARM: OMAP3 PM: Enable IO Wake up
  2011-10-04 17:52 ` Vishwanath BS
@ 2011-10-04 17:52   ` Vishwanath BS
  -1 siblings, 0 replies; 24+ messages in thread
From: Vishwanath BS @ 2011-10-04 17:52 UTC (permalink / raw)
  To: linux-omap; +Cc: khilman, linux-arm-kernel, Vishwanath BS

Enable IO Wake up for OMAP3 as part of PM Init.
Currently this has been managed in cpuidle path which is not the right place.
Subsequent patch will remove IO Daisy chain handling in cpuidle path once daisy
chain is handled as part of hwmod mux.

Signed-off-by: Vishwanath BS <vishwanath.bs@ti.com>
---
 arch/arm/mach-omap2/pm34xx.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c
index 61f1a5b..6c80988 100644
--- a/arch/arm/mach-omap2/pm34xx.c
+++ b/arch/arm/mach-omap2/pm34xx.c
@@ -885,6 +885,9 @@ static int __init omap3_pm_init(void)
 		goto err1;
 	}
 
+	if (omap3_has_io_wakeup())
+		omap2_prm_set_mod_reg_bits(OMAP3430_EN_IO_MASK, WKUP_MOD, PM_WKEN);
+
 	ret = pwrdm_for_each(pwrdms_setup, NULL);
 	if (ret) {
 		printk(KERN_ERR "Failed to setup powerdomains\n");
-- 
1.7.0.4


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

* [PATCH 3/4] ARM: OMAP3 PM: Enable IO Wake up
@ 2011-10-04 17:52   ` Vishwanath BS
  0 siblings, 0 replies; 24+ messages in thread
From: Vishwanath BS @ 2011-10-04 17:52 UTC (permalink / raw)
  To: linux-arm-kernel

Enable IO Wake up for OMAP3 as part of PM Init.
Currently this has been managed in cpuidle path which is not the right place.
Subsequent patch will remove IO Daisy chain handling in cpuidle path once daisy
chain is handled as part of hwmod mux.

Signed-off-by: Vishwanath BS <vishwanath.bs@ti.com>
---
 arch/arm/mach-omap2/pm34xx.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c
index 61f1a5b..6c80988 100644
--- a/arch/arm/mach-omap2/pm34xx.c
+++ b/arch/arm/mach-omap2/pm34xx.c
@@ -885,6 +885,9 @@ static int __init omap3_pm_init(void)
 		goto err1;
 	}
 
+	if (omap3_has_io_wakeup())
+		omap2_prm_set_mod_reg_bits(OMAP3430_EN_IO_MASK, WKUP_MOD, PM_WKEN);
+
 	ret = pwrdm_for_each(pwrdms_setup, NULL);
 	if (ret) {
 		printk(KERN_ERR "Failed to setup powerdomains\n");
-- 
1.7.0.4

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

* [PATCH 4/4] ARM: OMAP3PLUS PM: Add IO Daisychain support via hwmod mux
  2011-10-04 17:52 ` Vishwanath BS
@ 2011-10-04 17:52   ` Vishwanath BS
  -1 siblings, 0 replies; 24+ messages in thread
From: Vishwanath BS @ 2011-10-04 17:52 UTC (permalink / raw)
  To: linux-omap; +Cc: khilman, linux-arm-kernel, Vishwanath BS

IO Daisychain feature has to be triggered whenever there is a change in
device's mux configuration.
The patch also removes IO Daisychain control from OMAP3 CPUIdle path since
it is not required anymore as it has handled via hwmod mux.

omap3_enable_io_chain is renamed as omap3_trigger_wuclk_ctrl as it is not really
enabling daisychain feature rather it triggers WUCLK CTRL.

Signed-off-by: Vishwanath BS <vishwanath.bs@ti.com>
---
 arch/arm/mach-omap2/omap_hwmod.c |    9 +++++++--
 arch/arm/mach-omap2/pm.c         |    9 +++++++++
 arch/arm/mach-omap2/pm.h         |    3 ++-
 arch/arm/mach-omap2/pm34xx.c     |   26 ++------------------------
 4 files changed, 20 insertions(+), 27 deletions(-)

diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c
index 84cc0bd..070f3f5 100644
--- a/arch/arm/mach-omap2/omap_hwmod.c
+++ b/arch/arm/mach-omap2/omap_hwmod.c
@@ -151,6 +151,7 @@
 #include "prm44xx.h"
 #include "prminst44xx.h"
 #include "mux.h"
+#include "pm.h"
 
 /* Maximum microseconds to wait for OMAP module to softreset */
 #define MAX_MODULE_SOFTRESET_WAIT	10000
@@ -1462,8 +1463,10 @@ static int _enable(struct omap_hwmod *oh)
 	/* Mux pins for device runtime if populated */
 	if (oh->mux && (!oh->mux->enabled ||
 			((oh->_state == _HWMOD_STATE_IDLE) &&
-			 oh->mux->pads_dynamic)))
+			 oh->mux->pads_dynamic))) {
 		omap_hwmod_mux(oh->mux, _HWMOD_STATE_ENABLED);
+		omap_trigger_wuclk_ctrl();
+	}
 
 	_add_initiator_dep(oh, mpu_oh);
 
@@ -1553,8 +1556,10 @@ static int _idle(struct omap_hwmod *oh)
 		clkdm_hwmod_disable(oh->clkdm, oh);
 
 	/* Mux pins for device idle if populated */
-	if (oh->mux && oh->mux->pads_dynamic)
+	if (oh->mux && oh->mux->pads_dynamic) {
 		omap_hwmod_mux(oh->mux, _HWMOD_STATE_IDLE);
+		omap_trigger_wuclk_ctrl();
+	}
 
 	oh->_state = _HWMOD_STATE_IDLE;
 
diff --git a/arch/arm/mach-omap2/pm.c b/arch/arm/mach-omap2/pm.c
index 3feb359..c3295fe 100644
--- a/arch/arm/mach-omap2/pm.c
+++ b/arch/arm/mach-omap2/pm.c
@@ -95,6 +95,15 @@ static void omap2_init_processor_devices(void)
 	}
 }
 
+void omap_trigger_wuclk_ctrl(void)
+{
+	if (cpu_is_omap34xx())
+		omap3_trigger_wuclk_ctrl();
+
+	if (cpu_is_omap44xx())
+		omap4_trigger_wuclk_ctrl();
+}
+
 /* Types of sleep_switch used in omap_set_pwrdm_state */
 #define FORCEWAKEUP_SWITCH	0
 #define LOWPOWERSTATE_SWITCH	1
diff --git a/arch/arm/mach-omap2/pm.h b/arch/arm/mach-omap2/pm.h
index 2e09d72..9784d81 100644
--- a/arch/arm/mach-omap2/pm.h
+++ b/arch/arm/mach-omap2/pm.h
@@ -21,8 +21,9 @@ extern void omap_sram_idle(void);
 extern int omap3_can_sleep(void);
 extern int omap_set_pwrdm_state(struct powerdomain *pwrdm, u32 state);
 extern int omap3_idle_init(void);
-extern void omap3_enable_io_chain(void);
+extern void omap3_trigger_wuclk_ctrl(void);
 extern void omap4_trigger_wuclk_ctrl(void);
+extern void omap_trigger_wuclk_ctrl(void);
 
 #if defined(CONFIG_PM_OPP)
 extern int omap3_opp_init(void);
diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c
index 6c80988..6417ccb 100644
--- a/arch/arm/mach-omap2/pm34xx.c
+++ b/arch/arm/mach-omap2/pm34xx.c
@@ -95,11 +95,11 @@ static inline void omap3_per_restore_context(void)
 	omap_gpio_restore_context();
 }
 
-void omap3_enable_io_chain(void)
+void omap3_trigger_wuclk_ctrl(void)
 {
 	int timeout = 0;
 
-	if (omap_rev() >= OMAP3430_REV_ES3_1) {
+	if ((omap_rev() >= OMAP3430_REV_ES3_1) && omap3_has_io_wakeup()) {
 		omap2_prm_set_mod_reg_bits(OMAP3430_EN_IO_CHAIN_MASK, WKUP_MOD,
 				     PM_WKEN);
 		/* Do a readback to assure write has been done */
@@ -119,13 +119,6 @@ void omap3_enable_io_chain(void)
 	}
 }
 
-static void omap3_disable_io_chain(void)
-{
-	if (omap_rev() >= OMAP3430_REV_ES3_1)
-		omap2_prm_clear_mod_reg_bits(OMAP3430_EN_IO_CHAIN_MASK, WKUP_MOD,
-				       PM_WKEN);
-}
-
 static void omap3_core_save_context(void)
 {
 	omap3_ctrl_save_padconf();
@@ -372,12 +365,6 @@ void omap_sram_idle(void)
 	/* Enable IO-PAD and IO-CHAIN wakeups */
 	per_next_state = pwrdm_read_next_pwrst(per_pwrdm);
 	core_next_state = pwrdm_read_next_pwrst(core_pwrdm);
-	if (omap3_has_io_wakeup() &&
-	    (per_next_state < PWRDM_POWER_ON ||
-	     core_next_state < PWRDM_POWER_ON)) {
-		omap2_prm_set_mod_reg_bits(OMAP3430_EN_IO_MASK, WKUP_MOD, PM_WKEN);
-		omap3_enable_io_chain();
-	}
 
 	/* Block console output in case it is on one of the OMAP UARTs */
 	if (!is_suspending())
@@ -469,15 +456,6 @@ void omap_sram_idle(void)
 		console_unlock();
 
 console_still_active:
-	/* Disable IO-PAD and IO-CHAIN wakeup */
-	if (omap3_has_io_wakeup() &&
-	    (per_next_state < PWRDM_POWER_ON ||
-	     core_next_state < PWRDM_POWER_ON)) {
-		omap2_prm_clear_mod_reg_bits(OMAP3430_EN_IO_MASK, WKUP_MOD,
-					     PM_WKEN);
-		omap3_disable_io_chain();
-	}
-
 	pwrdm_post_transition();
 
 	clkdm_allow_idle(mpu_pwrdm->pwrdm_clkdms[0]);
-- 
1.7.0.4


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

* [PATCH 4/4] ARM: OMAP3PLUS PM: Add IO Daisychain support via hwmod mux
@ 2011-10-04 17:52   ` Vishwanath BS
  0 siblings, 0 replies; 24+ messages in thread
From: Vishwanath BS @ 2011-10-04 17:52 UTC (permalink / raw)
  To: linux-arm-kernel

IO Daisychain feature has to be triggered whenever there is a change in
device's mux configuration.
The patch also removes IO Daisychain control from OMAP3 CPUIdle path since
it is not required anymore as it has handled via hwmod mux.

omap3_enable_io_chain is renamed as omap3_trigger_wuclk_ctrl as it is not really
enabling daisychain feature rather it triggers WUCLK CTRL.

Signed-off-by: Vishwanath BS <vishwanath.bs@ti.com>
---
 arch/arm/mach-omap2/omap_hwmod.c |    9 +++++++--
 arch/arm/mach-omap2/pm.c         |    9 +++++++++
 arch/arm/mach-omap2/pm.h         |    3 ++-
 arch/arm/mach-omap2/pm34xx.c     |   26 ++------------------------
 4 files changed, 20 insertions(+), 27 deletions(-)

diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c
index 84cc0bd..070f3f5 100644
--- a/arch/arm/mach-omap2/omap_hwmod.c
+++ b/arch/arm/mach-omap2/omap_hwmod.c
@@ -151,6 +151,7 @@
 #include "prm44xx.h"
 #include "prminst44xx.h"
 #include "mux.h"
+#include "pm.h"
 
 /* Maximum microseconds to wait for OMAP module to softreset */
 #define MAX_MODULE_SOFTRESET_WAIT	10000
@@ -1462,8 +1463,10 @@ static int _enable(struct omap_hwmod *oh)
 	/* Mux pins for device runtime if populated */
 	if (oh->mux && (!oh->mux->enabled ||
 			((oh->_state == _HWMOD_STATE_IDLE) &&
-			 oh->mux->pads_dynamic)))
+			 oh->mux->pads_dynamic))) {
 		omap_hwmod_mux(oh->mux, _HWMOD_STATE_ENABLED);
+		omap_trigger_wuclk_ctrl();
+	}
 
 	_add_initiator_dep(oh, mpu_oh);
 
@@ -1553,8 +1556,10 @@ static int _idle(struct omap_hwmod *oh)
 		clkdm_hwmod_disable(oh->clkdm, oh);
 
 	/* Mux pins for device idle if populated */
-	if (oh->mux && oh->mux->pads_dynamic)
+	if (oh->mux && oh->mux->pads_dynamic) {
 		omap_hwmod_mux(oh->mux, _HWMOD_STATE_IDLE);
+		omap_trigger_wuclk_ctrl();
+	}
 
 	oh->_state = _HWMOD_STATE_IDLE;
 
diff --git a/arch/arm/mach-omap2/pm.c b/arch/arm/mach-omap2/pm.c
index 3feb359..c3295fe 100644
--- a/arch/arm/mach-omap2/pm.c
+++ b/arch/arm/mach-omap2/pm.c
@@ -95,6 +95,15 @@ static void omap2_init_processor_devices(void)
 	}
 }
 
+void omap_trigger_wuclk_ctrl(void)
+{
+	if (cpu_is_omap34xx())
+		omap3_trigger_wuclk_ctrl();
+
+	if (cpu_is_omap44xx())
+		omap4_trigger_wuclk_ctrl();
+}
+
 /* Types of sleep_switch used in omap_set_pwrdm_state */
 #define FORCEWAKEUP_SWITCH	0
 #define LOWPOWERSTATE_SWITCH	1
diff --git a/arch/arm/mach-omap2/pm.h b/arch/arm/mach-omap2/pm.h
index 2e09d72..9784d81 100644
--- a/arch/arm/mach-omap2/pm.h
+++ b/arch/arm/mach-omap2/pm.h
@@ -21,8 +21,9 @@ extern void omap_sram_idle(void);
 extern int omap3_can_sleep(void);
 extern int omap_set_pwrdm_state(struct powerdomain *pwrdm, u32 state);
 extern int omap3_idle_init(void);
-extern void omap3_enable_io_chain(void);
+extern void omap3_trigger_wuclk_ctrl(void);
 extern void omap4_trigger_wuclk_ctrl(void);
+extern void omap_trigger_wuclk_ctrl(void);
 
 #if defined(CONFIG_PM_OPP)
 extern int omap3_opp_init(void);
diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c
index 6c80988..6417ccb 100644
--- a/arch/arm/mach-omap2/pm34xx.c
+++ b/arch/arm/mach-omap2/pm34xx.c
@@ -95,11 +95,11 @@ static inline void omap3_per_restore_context(void)
 	omap_gpio_restore_context();
 }
 
-void omap3_enable_io_chain(void)
+void omap3_trigger_wuclk_ctrl(void)
 {
 	int timeout = 0;
 
-	if (omap_rev() >= OMAP3430_REV_ES3_1) {
+	if ((omap_rev() >= OMAP3430_REV_ES3_1) && omap3_has_io_wakeup()) {
 		omap2_prm_set_mod_reg_bits(OMAP3430_EN_IO_CHAIN_MASK, WKUP_MOD,
 				     PM_WKEN);
 		/* Do a readback to assure write has been done */
@@ -119,13 +119,6 @@ void omap3_enable_io_chain(void)
 	}
 }
 
-static void omap3_disable_io_chain(void)
-{
-	if (omap_rev() >= OMAP3430_REV_ES3_1)
-		omap2_prm_clear_mod_reg_bits(OMAP3430_EN_IO_CHAIN_MASK, WKUP_MOD,
-				       PM_WKEN);
-}
-
 static void omap3_core_save_context(void)
 {
 	omap3_ctrl_save_padconf();
@@ -372,12 +365,6 @@ void omap_sram_idle(void)
 	/* Enable IO-PAD and IO-CHAIN wakeups */
 	per_next_state = pwrdm_read_next_pwrst(per_pwrdm);
 	core_next_state = pwrdm_read_next_pwrst(core_pwrdm);
-	if (omap3_has_io_wakeup() &&
-	    (per_next_state < PWRDM_POWER_ON ||
-	     core_next_state < PWRDM_POWER_ON)) {
-		omap2_prm_set_mod_reg_bits(OMAP3430_EN_IO_MASK, WKUP_MOD, PM_WKEN);
-		omap3_enable_io_chain();
-	}
 
 	/* Block console output in case it is on one of the OMAP UARTs */
 	if (!is_suspending())
@@ -469,15 +456,6 @@ void omap_sram_idle(void)
 		console_unlock();
 
 console_still_active:
-	/* Disable IO-PAD and IO-CHAIN wakeup */
-	if (omap3_has_io_wakeup() &&
-	    (per_next_state < PWRDM_POWER_ON ||
-	     core_next_state < PWRDM_POWER_ON)) {
-		omap2_prm_clear_mod_reg_bits(OMAP3430_EN_IO_MASK, WKUP_MOD,
-					     PM_WKEN);
-		omap3_disable_io_chain();
-	}
-
 	pwrdm_post_transition();
 
 	clkdm_allow_idle(mpu_pwrdm->pwrdm_clkdms[0]);
-- 
1.7.0.4

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

* Re: [PATCH 1/4] ARM: OMAP3 PM: Fix IO Daisychain sequence
  2011-10-04 17:52   ` Vishwanath BS
@ 2011-10-04 18:54     ` Tony Lindgren
  -1 siblings, 0 replies; 24+ messages in thread
From: Tony Lindgren @ 2011-10-04 18:54 UTC (permalink / raw)
  To: Vishwanath BS; +Cc: linux-omap, khilman, linux-arm-kernel

* Vishwanath BS <vishwanath.bs@ti.com> [111004 10:25]:
> @@ -105,7 +105,7 @@ static void omap3_enable_io_chain(void)
>  		/* Do a readback to assure write has been done */
>  		omap2_prm_read_mod_reg(WKUP_MOD, PM_WKEN);
>  
> -		while (!(omap2_prm_read_mod_reg(WKUP_MOD, PM_WKEN) &
> +		while (!(omap2_prm_read_mod_reg(WKUP_MOD, PM_WKST) &
>  			 OMAP3430_ST_IO_CHAIN_MASK)) {
>  			timeout++;
>  			if (timeout > 1000) {

Checking for PM_WKST here makes sense..

> @@ -114,7 +114,7 @@ static void omap3_enable_io_chain(void)
>  				return;
>  			}
>  			omap2_prm_set_mod_reg_bits(OMAP3430_ST_IO_CHAIN_MASK,
> -					     WKUP_MOD, PM_WKEN);
> +					     WKUP_MOD, PM_WKST);
>  		}
>  	}
>  }

..but are you sure you also want to write into PM_WKST?

Tony

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

* [PATCH 1/4] ARM: OMAP3 PM: Fix IO Daisychain sequence
@ 2011-10-04 18:54     ` Tony Lindgren
  0 siblings, 0 replies; 24+ messages in thread
From: Tony Lindgren @ 2011-10-04 18:54 UTC (permalink / raw)
  To: linux-arm-kernel

* Vishwanath BS <vishwanath.bs@ti.com> [111004 10:25]:
> @@ -105,7 +105,7 @@ static void omap3_enable_io_chain(void)
>  		/* Do a readback to assure write has been done */
>  		omap2_prm_read_mod_reg(WKUP_MOD, PM_WKEN);
>  
> -		while (!(omap2_prm_read_mod_reg(WKUP_MOD, PM_WKEN) &
> +		while (!(omap2_prm_read_mod_reg(WKUP_MOD, PM_WKST) &
>  			 OMAP3430_ST_IO_CHAIN_MASK)) {
>  			timeout++;
>  			if (timeout > 1000) {

Checking for PM_WKST here makes sense..

> @@ -114,7 +114,7 @@ static void omap3_enable_io_chain(void)
>  				return;
>  			}
>  			omap2_prm_set_mod_reg_bits(OMAP3430_ST_IO_CHAIN_MASK,
> -					     WKUP_MOD, PM_WKEN);
> +					     WKUP_MOD, PM_WKST);
>  		}
>  	}
>  }

..but are you sure you also want to write into PM_WKST?

Tony

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

* Re: [PATCH 1/4] ARM: OMAP3 PM: Fix IO Daisychain sequence
  2011-10-04 17:52   ` Vishwanath BS
@ 2011-10-04 20:47     ` Kevin Hilman
  -1 siblings, 0 replies; 24+ messages in thread
From: Kevin Hilman @ 2011-10-04 20:47 UTC (permalink / raw)
  To: Vishwanath BS; +Cc: linux-omap, linux-arm-kernel, mohanv

Hi Vishwa,

Vishwanath BS <vishwanath.bs@ti.com> writes:

> As per OMAP3630 TRM Section 3.5.7.2.2, the right sequence for enabling IO Daisy
> chain is "The I/O wake-up scheme is enabled by triggering the I/O daisy chain
> control (Wu clock) by programming a dedicated register
> (PRCM.PM_WKEN_WKUP[16] EN_IO_CHAIN) in the PRCM module.Software must wait for
> the I/O daisy chain to complete before it transitions the PER domain to a
> nonfunctional state. This is done by polling a dedicated status bit in the PRCM
> module (PRCM.PM_WKST_WKUP[16] ST_IO_CHAIN). This status bit must be cleared by
> software when the bit is read to  1".
>
> The original code was polling on a wrong register which is fixed in this patch.
> Also omap3_enable_io_chain is made non static as it's going to be used in
> subsequent patches.
>  
> Signed-off-by: Vishwanath BS <vishwanath.bs@ti.com>

A fix for this was posted[1] by Mohan V (added to Cc) back in June.  It
recieved a few minor comments but an updated version was never posted.

Maybe you can ping Mohan or update that version fixing the comments
mentioned in that thread.

Thanks,

Kevin

[1] http://marc.info/?l=linux-omap&w=2&r=1&s=%27Mohan+V%27&q=b

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

* [PATCH 1/4] ARM: OMAP3 PM: Fix IO Daisychain sequence
@ 2011-10-04 20:47     ` Kevin Hilman
  0 siblings, 0 replies; 24+ messages in thread
From: Kevin Hilman @ 2011-10-04 20:47 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Vishwa,

Vishwanath BS <vishwanath.bs@ti.com> writes:

> As per OMAP3630 TRM Section 3.5.7.2.2, the right sequence for enabling IO Daisy
> chain is "The I/O wake-up scheme is enabled by triggering the I/O daisy chain
> control (Wu clock) by programming a dedicated register
> (PRCM.PM_WKEN_WKUP[16] EN_IO_CHAIN) in the PRCM module.Software must wait for
> the I/O daisy chain to complete before it transitions the PER domain to a
> nonfunctional state. This is done by polling a dedicated status bit in the PRCM
> module (PRCM.PM_WKST_WKUP[16] ST_IO_CHAIN). This status bit must be cleared by
> software when the bit is read to  1".
>
> The original code was polling on a wrong register which is fixed in this patch.
> Also omap3_enable_io_chain is made non static as it's going to be used in
> subsequent patches.
>  
> Signed-off-by: Vishwanath BS <vishwanath.bs@ti.com>

A fix for this was posted[1] by Mohan V (added to Cc) back in June.  It
recieved a few minor comments but an updated version was never posted.

Maybe you can ping Mohan or update that version fixing the comments
mentioned in that thread.

Thanks,

Kevin

[1] http://marc.info/?l=linux-omap&w=2&r=1&s=%27Mohan+V%27&q=b

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

* RE: [PATCH 1/4] ARM: OMAP3 PM: Fix IO Daisychain sequence
  2011-10-04 20:47     ` Kevin Hilman
@ 2011-10-05  4:19       ` Vishwanath Sripathy
  -1 siblings, 0 replies; 24+ messages in thread
From: Vishwanath Sripathy @ 2011-10-05  4:19 UTC (permalink / raw)
  To: Kevin Hilman; +Cc: linux-omap, linux-arm-kernel, Mohan Viswanathan

> -----Original Message-----
> From: Kevin Hilman [mailto:khilman@ti.com]
> Sent: Wednesday, October 05, 2011 2:18 AM
> To: Vishwanath BS
> Cc: linux-omap@vger.kernel.org; linux-arm-
> kernel@lists.infradead.org; mohanv@ti.com
> Subject: Re: [PATCH 1/4] ARM: OMAP3 PM: Fix IO Daisychain sequence
>
> Hi Vishwa,
>
> Vishwanath BS <vishwanath.bs@ti.com> writes:
>
> > As per OMAP3630 TRM Section 3.5.7.2.2, the right sequence for
> enabling IO Daisy
> > chain is "The I/O wake-up scheme is enabled by triggering the I/O
> daisy chain
> > control (Wu clock) by programming a dedicated register
> > (PRCM.PM_WKEN_WKUP[16] EN_IO_CHAIN) in the PRCM module.Software
> must wait for
> > the I/O daisy chain to complete before it transitions the PER
> domain to a
> > nonfunctional state. This is done by polling a dedicated status
> bit in the PRCM
> > module (PRCM.PM_WKST_WKUP[16] ST_IO_CHAIN). This status bit must
> be cleared by
> > software when the bit is read to  1".
> >
> > The original code was polling on a wrong register which is fixed
> in this patch.
> > Also omap3_enable_io_chain is made non static as it's going to be
> used in
> > subsequent patches.
> >
> > Signed-off-by: Vishwanath BS <vishwanath.bs@ti.com>
>
> A fix for this was posted[1] by Mohan V (added to Cc) back in June.
> It
> recieved a few minor comments but an updated version was never
> posted.
>
> Maybe you can ping Mohan or update that version fixing the comments
> mentioned in that thread.
OK. I will update the original patchset from Mohan with your comments and
repost.

Vishwa
>
> Thanks,
>
> Kevin
>
> [1] http://marc.info/?l=linux-omap&w=2&r=1&s=%27Mohan+V%27&q=b

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

* [PATCH 1/4] ARM: OMAP3 PM: Fix IO Daisychain sequence
@ 2011-10-05  4:19       ` Vishwanath Sripathy
  0 siblings, 0 replies; 24+ messages in thread
From: Vishwanath Sripathy @ 2011-10-05  4:19 UTC (permalink / raw)
  To: linux-arm-kernel

> -----Original Message-----
> From: Kevin Hilman [mailto:khilman at ti.com]
> Sent: Wednesday, October 05, 2011 2:18 AM
> To: Vishwanath BS
> Cc: linux-omap at vger.kernel.org; linux-arm-
> kernel at lists.infradead.org; mohanv at ti.com
> Subject: Re: [PATCH 1/4] ARM: OMAP3 PM: Fix IO Daisychain sequence
>
> Hi Vishwa,
>
> Vishwanath BS <vishwanath.bs@ti.com> writes:
>
> > As per OMAP3630 TRM Section 3.5.7.2.2, the right sequence for
> enabling IO Daisy
> > chain is "The I/O wake-up scheme is enabled by triggering the I/O
> daisy chain
> > control (Wu clock) by programming a dedicated register
> > (PRCM.PM_WKEN_WKUP[16] EN_IO_CHAIN) in the PRCM module.Software
> must wait for
> > the I/O daisy chain to complete before it transitions the PER
> domain to a
> > nonfunctional state. This is done by polling a dedicated status
> bit in the PRCM
> > module (PRCM.PM_WKST_WKUP[16] ST_IO_CHAIN). This status bit must
> be cleared by
> > software when the bit is read to  1".
> >
> > The original code was polling on a wrong register which is fixed
> in this patch.
> > Also omap3_enable_io_chain is made non static as it's going to be
> used in
> > subsequent patches.
> >
> > Signed-off-by: Vishwanath BS <vishwanath.bs@ti.com>
>
> A fix for this was posted[1] by Mohan V (added to Cc) back in June.
> It
> recieved a few minor comments but an updated version was never
> posted.
>
> Maybe you can ping Mohan or update that version fixing the comments
> mentioned in that thread.
OK. I will update the original patchset from Mohan with your comments and
repost.

Vishwa
>
> Thanks,
>
> Kevin
>
> [1] http://marc.info/?l=linux-omap&w=2&r=1&s=%27Mohan+V%27&q=b

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

* Re: [PATCH 2/4] ARM: OMAP4 PM: Add IO Daisychain support
  2011-10-04 17:52   ` Vishwanath BS
@ 2011-10-07  8:13     ` Paul Walmsley
  -1 siblings, 0 replies; 24+ messages in thread
From: Paul Walmsley @ 2011-10-07  8:13 UTC (permalink / raw)
  To: Vishwanath BS; +Cc: linux-omap, khilman, linux-arm-kernel, Rajendra Nayak

Hi

some comments:

On Tue, 4 Oct 2011, Vishwanath BS wrote:

> From: Rajendra Nayak <rnayak@ti.com>
> 
> patch adds IO Daisychain support for OMAP4 as per section 3.9.4 in OMAP4430
> Public TRM.
> 
> Signed-off-by: Rajendra Nayak <rnayak@ti.com>
> Signed-off-by: Vishwanath BS <vishwanath.bs@ti.com>
> ---
>  arch/arm/mach-omap2/pm.h     |    1 +
>  arch/arm/mach-omap2/pm44xx.c |   36 ++++++++++++++++++++++++++++++++++++
>  2 files changed, 37 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/arm/mach-omap2/pm.h b/arch/arm/mach-omap2/pm.h
> index 9a36a7c..2e09d72 100644
> --- a/arch/arm/mach-omap2/pm.h
> +++ b/arch/arm/mach-omap2/pm.h
> @@ -22,6 +22,7 @@ extern int omap3_can_sleep(void);
>  extern int omap_set_pwrdm_state(struct powerdomain *pwrdm, u32 state);
>  extern int omap3_idle_init(void);
>  extern void omap3_enable_io_chain(void);
> +extern void omap4_trigger_wuclk_ctrl(void);
>  
>  #if defined(CONFIG_PM_OPP)
>  extern int omap3_opp_init(void);
> diff --git a/arch/arm/mach-omap2/pm44xx.c b/arch/arm/mach-omap2/pm44xx.c
> index 59a870b..aa7cff4 100644
> --- a/arch/arm/mach-omap2/pm44xx.c
> +++ b/arch/arm/mach-omap2/pm44xx.c
> @@ -16,8 +16,17 @@
>  #include <linux/err.h>
>  #include <linux/slab.h>
>  
> +#include <plat/common.h>
> +
>  #include "powerdomain.h"
>  #include <mach/omap4-common.h>
> +#include "pm.h"
> +#include "cm-regbits-44xx.h"
> +#include "cminst44xx.h"
> +#include "prm-regbits-44xx.h"
> +#include "prcm44xx.h"
> +#include "prm44xx.h"
> +#include "prminst44xx.h"
>  
>  struct power_state {
>  	struct powerdomain *pwrdm;
> @@ -30,6 +39,33 @@ struct power_state {
>  
>  static LIST_HEAD(pwrst_list);
>  
> +#define MAX_IOPAD_LATCH_TIME 1000

This macro is missing a comment, which should precede it, describing what 
this value is.

> +
> +void omap4_trigger_wuclk_ctrl(void)
> +{
> +	int i = 0;
> +
> +	/* Enable GLOBAL_WUEN */
> +	if (!omap4_cminst_read_inst_reg_bits(OMAP4430_PRM_PARTITION,
> +			OMAP4430_PRM_DEVICE_INST, OMAP4_PRM_IO_PMCTRL_OFFSET,
> +			OMAP4430_GLOBAL_WUEN_MASK))

The above line doesn't look right.  It's accessing a PRM instance register 
with omap4_cminst_*()?  Shouldn't that be omap4_prminst_*()?

> +		omap4_prminst_rmw_inst_reg_bits(OMAP4430_GLOBAL_WUEN_MASK,
> +			OMAP4430_GLOBAL_WUEN_MASK, OMAP4430_PRM_PARTITION,
> +			OMAP4430_PRM_DEVICE_INST, OMAP4_PRM_IO_PMCTRL_OFFSET);
> +
> +	/* Trigger WUCLKIN enable */
> +	omap4_prminst_rmw_inst_reg_bits(OMAP4430_WUCLK_CTRL_MASK, OMAP4430_WUCLK_CTRL_MASK,
> +		OMAP4430_PRM_PARTITION, OMAP4430_PRM_DEVICE_INST, OMAP4_PRM_IO_PMCTRL_OFFSET);
> +	omap_test_timeout(
> +		((omap4_prminst_read_inst_reg(OMAP4430_PRM_PARTITION, OMAP4430_PRM_DEVICE_INST, OMAP4_PRM_IO_PMCTRL_OFFSET)
> +		>> OMAP4430_WUCLK_STATUS_SHIFT) == 1),
> +		MAX_IOPAD_LATCH_TIME, i);
> +	/* Trigger WUCLKIN disable */
> +	omap4_prminst_rmw_inst_reg_bits(OMAP4430_WUCLK_CTRL_MASK, 0x0,
> +		OMAP4430_PRM_PARTITION, OMAP4430_PRM_DEVICE_INST, OMAP4_PRM_IO_PMCTRL_OFFSET);
> +	return;
> +}

This function belongs in mach-omap2/prminst44xx.c.  I still think it would 
be good if we moved all PRM/CM direct register accesses into prm*.c or 
cm*.c files in mach-omap2/.  Then none of those prm*.h includes would be 
needed in pm44xx.c either.

> +
>  #ifdef CONFIG_SUSPEND
>  static int omap4_pm_suspend(void)
>  {
> -- 
> 1.7.0.4
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-omap" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 


- Paul

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

* [PATCH 2/4] ARM: OMAP4 PM: Add IO Daisychain support
@ 2011-10-07  8:13     ` Paul Walmsley
  0 siblings, 0 replies; 24+ messages in thread
From: Paul Walmsley @ 2011-10-07  8:13 UTC (permalink / raw)
  To: linux-arm-kernel

Hi

some comments:

On Tue, 4 Oct 2011, Vishwanath BS wrote:

> From: Rajendra Nayak <rnayak@ti.com>
> 
> patch adds IO Daisychain support for OMAP4 as per section 3.9.4 in OMAP4430
> Public TRM.
> 
> Signed-off-by: Rajendra Nayak <rnayak@ti.com>
> Signed-off-by: Vishwanath BS <vishwanath.bs@ti.com>
> ---
>  arch/arm/mach-omap2/pm.h     |    1 +
>  arch/arm/mach-omap2/pm44xx.c |   36 ++++++++++++++++++++++++++++++++++++
>  2 files changed, 37 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/arm/mach-omap2/pm.h b/arch/arm/mach-omap2/pm.h
> index 9a36a7c..2e09d72 100644
> --- a/arch/arm/mach-omap2/pm.h
> +++ b/arch/arm/mach-omap2/pm.h
> @@ -22,6 +22,7 @@ extern int omap3_can_sleep(void);
>  extern int omap_set_pwrdm_state(struct powerdomain *pwrdm, u32 state);
>  extern int omap3_idle_init(void);
>  extern void omap3_enable_io_chain(void);
> +extern void omap4_trigger_wuclk_ctrl(void);
>  
>  #if defined(CONFIG_PM_OPP)
>  extern int omap3_opp_init(void);
> diff --git a/arch/arm/mach-omap2/pm44xx.c b/arch/arm/mach-omap2/pm44xx.c
> index 59a870b..aa7cff4 100644
> --- a/arch/arm/mach-omap2/pm44xx.c
> +++ b/arch/arm/mach-omap2/pm44xx.c
> @@ -16,8 +16,17 @@
>  #include <linux/err.h>
>  #include <linux/slab.h>
>  
> +#include <plat/common.h>
> +
>  #include "powerdomain.h"
>  #include <mach/omap4-common.h>
> +#include "pm.h"
> +#include "cm-regbits-44xx.h"
> +#include "cminst44xx.h"
> +#include "prm-regbits-44xx.h"
> +#include "prcm44xx.h"
> +#include "prm44xx.h"
> +#include "prminst44xx.h"
>  
>  struct power_state {
>  	struct powerdomain *pwrdm;
> @@ -30,6 +39,33 @@ struct power_state {
>  
>  static LIST_HEAD(pwrst_list);
>  
> +#define MAX_IOPAD_LATCH_TIME 1000

This macro is missing a comment, which should precede it, describing what 
this value is.

> +
> +void omap4_trigger_wuclk_ctrl(void)
> +{
> +	int i = 0;
> +
> +	/* Enable GLOBAL_WUEN */
> +	if (!omap4_cminst_read_inst_reg_bits(OMAP4430_PRM_PARTITION,
> +			OMAP4430_PRM_DEVICE_INST, OMAP4_PRM_IO_PMCTRL_OFFSET,
> +			OMAP4430_GLOBAL_WUEN_MASK))

The above line doesn't look right.  It's accessing a PRM instance register 
with omap4_cminst_*()?  Shouldn't that be omap4_prminst_*()?

> +		omap4_prminst_rmw_inst_reg_bits(OMAP4430_GLOBAL_WUEN_MASK,
> +			OMAP4430_GLOBAL_WUEN_MASK, OMAP4430_PRM_PARTITION,
> +			OMAP4430_PRM_DEVICE_INST, OMAP4_PRM_IO_PMCTRL_OFFSET);
> +
> +	/* Trigger WUCLKIN enable */
> +	omap4_prminst_rmw_inst_reg_bits(OMAP4430_WUCLK_CTRL_MASK, OMAP4430_WUCLK_CTRL_MASK,
> +		OMAP4430_PRM_PARTITION, OMAP4430_PRM_DEVICE_INST, OMAP4_PRM_IO_PMCTRL_OFFSET);
> +	omap_test_timeout(
> +		((omap4_prminst_read_inst_reg(OMAP4430_PRM_PARTITION, OMAP4430_PRM_DEVICE_INST, OMAP4_PRM_IO_PMCTRL_OFFSET)
> +		>> OMAP4430_WUCLK_STATUS_SHIFT) == 1),
> +		MAX_IOPAD_LATCH_TIME, i);
> +	/* Trigger WUCLKIN disable */
> +	omap4_prminst_rmw_inst_reg_bits(OMAP4430_WUCLK_CTRL_MASK, 0x0,
> +		OMAP4430_PRM_PARTITION, OMAP4430_PRM_DEVICE_INST, OMAP4_PRM_IO_PMCTRL_OFFSET);
> +	return;
> +}

This function belongs in mach-omap2/prminst44xx.c.  I still think it would 
be good if we moved all PRM/CM direct register accesses into prm*.c or 
cm*.c files in mach-omap2/.  Then none of those prm*.h includes would be 
needed in pm44xx.c either.

> +
>  #ifdef CONFIG_SUSPEND
>  static int omap4_pm_suspend(void)
>  {
> -- 
> 1.7.0.4
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-omap" in
> the body of a message to majordomo at vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 


- Paul

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

* Re: [PATCH 1/4] ARM: OMAP3 PM: Fix IO Daisychain sequence
  2011-10-04 17:52   ` Vishwanath BS
@ 2011-10-07  8:19     ` Paul Walmsley
  -1 siblings, 0 replies; 24+ messages in thread
From: Paul Walmsley @ 2011-10-07  8:19 UTC (permalink / raw)
  To: Vishwanath BS; +Cc: linux-omap, khilman, linux-arm-kernel

Hi

a few comments:

On Tue, 4 Oct 2011, Vishwanath BS wrote:

> As per OMAP3630 TRM Section 3.5.7.2.2, the right sequence for enabling IO Daisy
> chain is "The I/O wake-up scheme is enabled by triggering the I/O daisy chain
> control (Wu clock) by programming a dedicated register
> (PRCM.PM_WKEN_WKUP[16] EN_IO_CHAIN) in the PRCM module.Software must wait for
> the I/O daisy chain to complete before it transitions the PER domain to a
> nonfunctional state. This is done by polling a dedicated status bit in the PRCM
> module (PRCM.PM_WKST_WKUP[16] ST_IO_CHAIN). This status bit must be cleared by
> software when the bit is read to  1".
> 
> The original code was polling on a wrong register which is fixed in this patch.
> Also omap3_enable_io_chain is made non static as it's going to be used in
> subsequent patches.

This patch should be split into a fix (for the WKEN/WKST bug) and then a 
new patch that drops the 'static'.  The new patch should also move this 
function to prm2xxx_3xxx.c for the same reason that the OMAP4 version of 
this function should be in prminst44xx.c.

In the medium-term, a bunch of the functions from prm2xxx_3xxx.c, 
prminst44xx.c, etc. that are only used by the mach-omap2/pm*.c code should 
be moved into the PRM driver that Tero is working on that will live in 
drivers/.

>  
> Signed-off-by: Vishwanath BS <vishwanath.bs@ti.com>
> ---
>  arch/arm/mach-omap2/pm.h     |    1 +
>  arch/arm/mach-omap2/pm34xx.c |    6 +++---
>  2 files changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/arm/mach-omap2/pm.h b/arch/arm/mach-omap2/pm.h
> index 4e166ad..9a36a7c 100644
> --- a/arch/arm/mach-omap2/pm.h
> +++ b/arch/arm/mach-omap2/pm.h
> @@ -21,6 +21,7 @@ extern void omap_sram_idle(void);
>  extern int omap3_can_sleep(void);
>  extern int omap_set_pwrdm_state(struct powerdomain *pwrdm, u32 state);
>  extern int omap3_idle_init(void);
> +extern void omap3_enable_io_chain(void);
>  
>  #if defined(CONFIG_PM_OPP)
>  extern int omap3_opp_init(void);
> diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c
> index 7255d9b..61f1a5b 100644
> --- a/arch/arm/mach-omap2/pm34xx.c
> +++ b/arch/arm/mach-omap2/pm34xx.c
> @@ -95,7 +95,7 @@ static inline void omap3_per_restore_context(void)
>  	omap_gpio_restore_context();
>  }
>  
> -static void omap3_enable_io_chain(void)
> +void omap3_enable_io_chain(void)
>  {
>  	int timeout = 0;
>  
> @@ -105,7 +105,7 @@ static void omap3_enable_io_chain(void)
>  		/* Do a readback to assure write has been done */
>  		omap2_prm_read_mod_reg(WKUP_MOD, PM_WKEN);
>  
> -		while (!(omap2_prm_read_mod_reg(WKUP_MOD, PM_WKEN) &
> +		while (!(omap2_prm_read_mod_reg(WKUP_MOD, PM_WKST) &
>  			 OMAP3430_ST_IO_CHAIN_MASK)) {
>  			timeout++;
>  			if (timeout > 1000) {
> @@ -114,7 +114,7 @@ static void omap3_enable_io_chain(void)
>  				return;
>  			}
>  			omap2_prm_set_mod_reg_bits(OMAP3430_ST_IO_CHAIN_MASK,
> -					     WKUP_MOD, PM_WKEN);
> +					     WKUP_MOD, PM_WKST);
>  		}
>  	}
>  }
> -- 
> 1.7.0.4
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-omap" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 


- Paul

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

* [PATCH 1/4] ARM: OMAP3 PM: Fix IO Daisychain sequence
@ 2011-10-07  8:19     ` Paul Walmsley
  0 siblings, 0 replies; 24+ messages in thread
From: Paul Walmsley @ 2011-10-07  8:19 UTC (permalink / raw)
  To: linux-arm-kernel

Hi

a few comments:

On Tue, 4 Oct 2011, Vishwanath BS wrote:

> As per OMAP3630 TRM Section 3.5.7.2.2, the right sequence for enabling IO Daisy
> chain is "The I/O wake-up scheme is enabled by triggering the I/O daisy chain
> control (Wu clock) by programming a dedicated register
> (PRCM.PM_WKEN_WKUP[16] EN_IO_CHAIN) in the PRCM module.Software must wait for
> the I/O daisy chain to complete before it transitions the PER domain to a
> nonfunctional state. This is done by polling a dedicated status bit in the PRCM
> module (PRCM.PM_WKST_WKUP[16] ST_IO_CHAIN). This status bit must be cleared by
> software when the bit is read to  1".
> 
> The original code was polling on a wrong register which is fixed in this patch.
> Also omap3_enable_io_chain is made non static as it's going to be used in
> subsequent patches.

This patch should be split into a fix (for the WKEN/WKST bug) and then a 
new patch that drops the 'static'.  The new patch should also move this 
function to prm2xxx_3xxx.c for the same reason that the OMAP4 version of 
this function should be in prminst44xx.c.

In the medium-term, a bunch of the functions from prm2xxx_3xxx.c, 
prminst44xx.c, etc. that are only used by the mach-omap2/pm*.c code should 
be moved into the PRM driver that Tero is working on that will live in 
drivers/.

>  
> Signed-off-by: Vishwanath BS <vishwanath.bs@ti.com>
> ---
>  arch/arm/mach-omap2/pm.h     |    1 +
>  arch/arm/mach-omap2/pm34xx.c |    6 +++---
>  2 files changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/arm/mach-omap2/pm.h b/arch/arm/mach-omap2/pm.h
> index 4e166ad..9a36a7c 100644
> --- a/arch/arm/mach-omap2/pm.h
> +++ b/arch/arm/mach-omap2/pm.h
> @@ -21,6 +21,7 @@ extern void omap_sram_idle(void);
>  extern int omap3_can_sleep(void);
>  extern int omap_set_pwrdm_state(struct powerdomain *pwrdm, u32 state);
>  extern int omap3_idle_init(void);
> +extern void omap3_enable_io_chain(void);
>  
>  #if defined(CONFIG_PM_OPP)
>  extern int omap3_opp_init(void);
> diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c
> index 7255d9b..61f1a5b 100644
> --- a/arch/arm/mach-omap2/pm34xx.c
> +++ b/arch/arm/mach-omap2/pm34xx.c
> @@ -95,7 +95,7 @@ static inline void omap3_per_restore_context(void)
>  	omap_gpio_restore_context();
>  }
>  
> -static void omap3_enable_io_chain(void)
> +void omap3_enable_io_chain(void)
>  {
>  	int timeout = 0;
>  
> @@ -105,7 +105,7 @@ static void omap3_enable_io_chain(void)
>  		/* Do a readback to assure write has been done */
>  		omap2_prm_read_mod_reg(WKUP_MOD, PM_WKEN);
>  
> -		while (!(omap2_prm_read_mod_reg(WKUP_MOD, PM_WKEN) &
> +		while (!(omap2_prm_read_mod_reg(WKUP_MOD, PM_WKST) &
>  			 OMAP3430_ST_IO_CHAIN_MASK)) {
>  			timeout++;
>  			if (timeout > 1000) {
> @@ -114,7 +114,7 @@ static void omap3_enable_io_chain(void)
>  				return;
>  			}
>  			omap2_prm_set_mod_reg_bits(OMAP3430_ST_IO_CHAIN_MASK,
> -					     WKUP_MOD, PM_WKEN);
> +					     WKUP_MOD, PM_WKST);
>  		}
>  	}
>  }
> -- 
> 1.7.0.4
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-omap" in
> the body of a message to majordomo at vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 


- Paul

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

* RE: [PATCH 2/4] ARM: OMAP4 PM: Add IO Daisychain support
  2011-10-07  8:13     ` Paul Walmsley
@ 2011-10-07 10:03       ` Vishwanath Sripathy
  -1 siblings, 0 replies; 24+ messages in thread
From: Vishwanath Sripathy @ 2011-10-07 10:03 UTC (permalink / raw)
  To: Paul Walmsley; +Cc: linux-omap, Kevin Hilman, linux-arm-kernel, Rajendra Nayak

> -----Original Message-----
> From: Paul Walmsley [mailto:paul@pwsan.com]
> Sent: Friday, October 07, 2011 1:44 PM
> To: Vishwanath BS
> Cc: linux-omap@vger.kernel.org; khilman@ti.com; linux-arm-
> kernel@lists.infradead.org; Rajendra Nayak
> Subject: Re: [PATCH 2/4] ARM: OMAP4 PM: Add IO Daisychain support
>
> Hi
>
> some comments:
>
> On Tue, 4 Oct 2011, Vishwanath BS wrote:
>
> > From: Rajendra Nayak <rnayak@ti.com>
> >
> > patch adds IO Daisychain support for OMAP4 as per section 3.9.4 in
> OMAP4430
> > Public TRM.
> >
> > Signed-off-by: Rajendra Nayak <rnayak@ti.com>
> > Signed-off-by: Vishwanath BS <vishwanath.bs@ti.com>
> > ---
> >  arch/arm/mach-omap2/pm.h     |    1 +
> >  arch/arm/mach-omap2/pm44xx.c |   36
> ++++++++++++++++++++++++++++++++++++
> >  2 files changed, 37 insertions(+), 0 deletions(-)
> >
> > diff --git a/arch/arm/mach-omap2/pm.h b/arch/arm/mach-omap2/pm.h
> > index 9a36a7c..2e09d72 100644
> > --- a/arch/arm/mach-omap2/pm.h
> > +++ b/arch/arm/mach-omap2/pm.h
> > @@ -22,6 +22,7 @@ extern int omap3_can_sleep(void);
> >  extern int omap_set_pwrdm_state(struct powerdomain *pwrdm, u32
> state);
> >  extern int omap3_idle_init(void);
> >  extern void omap3_enable_io_chain(void);
> > +extern void omap4_trigger_wuclk_ctrl(void);
> >
> >  #if defined(CONFIG_PM_OPP)
> >  extern int omap3_opp_init(void);
> > diff --git a/arch/arm/mach-omap2/pm44xx.c b/arch/arm/mach-
> omap2/pm44xx.c
> > index 59a870b..aa7cff4 100644
> > --- a/arch/arm/mach-omap2/pm44xx.c
> > +++ b/arch/arm/mach-omap2/pm44xx.c
> > @@ -16,8 +16,17 @@
> >  #include <linux/err.h>
> >  #include <linux/slab.h>
> >
> > +#include <plat/common.h>
> > +
> >  #include "powerdomain.h"
> >  #include <mach/omap4-common.h>
> > +#include "pm.h"
> > +#include "cm-regbits-44xx.h"
> > +#include "cminst44xx.h"
> > +#include "prm-regbits-44xx.h"
> > +#include "prcm44xx.h"
> > +#include "prm44xx.h"
> > +#include "prminst44xx.h"
> >
> >  struct power_state {
> >  	struct powerdomain *pwrdm;
> > @@ -30,6 +39,33 @@ struct power_state {
> >
> >  static LIST_HEAD(pwrst_list);
> >
> > +#define MAX_IOPAD_LATCH_TIME 1000
>
> This macro is missing a comment, which should precede it, describing
> what
> this value is.
OK
>
> > +
> > +void omap4_trigger_wuclk_ctrl(void)
> > +{
> > +	int i = 0;
> > +
> > +	/* Enable GLOBAL_WUEN */
> > +	if (!omap4_cminst_read_inst_reg_bits(OMAP4430_PRM_PARTITION,
> > +			OMAP4430_PRM_DEVICE_INST,
> OMAP4_PRM_IO_PMCTRL_OFFSET,
> > +			OMAP4430_GLOBAL_WUEN_MASK))
>
> The above line doesn't look right.  It's accessing a PRM instance
> register
> with omap4_cminst_*()?  Shouldn't that be omap4_prminst_*()?
Ya, it would make sense to use omap4_prminst_* though functionally both
have the same effect.

>
> > +
> 	omap4_prminst_rmw_inst_reg_bits(OMAP4430_GLOBAL_WUEN_MASK,
> > +			OMAP4430_GLOBAL_WUEN_MASK, OMAP4430_PRM_PARTITION,
> > +			OMAP4430_PRM_DEVICE_INST,
> OMAP4_PRM_IO_PMCTRL_OFFSET);
> > +
> > +	/* Trigger WUCLKIN enable */
> > +	omap4_prminst_rmw_inst_reg_bits(OMAP4430_WUCLK_CTRL_MASK,
> OMAP4430_WUCLK_CTRL_MASK,
> > +		OMAP4430_PRM_PARTITION, OMAP4430_PRM_DEVICE_INST,
> OMAP4_PRM_IO_PMCTRL_OFFSET);
> > +	omap_test_timeout(
> > +		((omap4_prminst_read_inst_reg(OMAP4430_PRM_PARTITION,
> OMAP4430_PRM_DEVICE_INST, OMAP4_PRM_IO_PMCTRL_OFFSET)
> > +		>> OMAP4430_WUCLK_STATUS_SHIFT) == 1),
> > +		MAX_IOPAD_LATCH_TIME, i);
> > +	/* Trigger WUCLKIN disable */
> > +	omap4_prminst_rmw_inst_reg_bits(OMAP4430_WUCLK_CTRL_MASK, 0x0,
> > +		OMAP4430_PRM_PARTITION, OMAP4430_PRM_DEVICE_INST,
> OMAP4_PRM_IO_PMCTRL_OFFSET);
> > +	return;
> > +}
>
> This function belongs in mach-omap2/prminst44xx.c.  I still think it
> would
> be good if we moved all PRM/CM direct register accesses into prm*.c
> or
> cm*.c files in mach-omap2/.  Then none of those prm*.h includes
> would be
> needed in pm44xx.c either.
OK. Let me explore that.

Regards
Vishwa
>
> > +
> >  #ifdef CONFIG_SUSPEND
> >  static int omap4_pm_suspend(void)
> >  {
> > --
> > 1.7.0.4
> >
> > --
> > To unsubscribe from this list: send the line "unsubscribe linux-
> omap" in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at  http://vger.kernel.org/majordomo-info.html
> >
>
>
> - Paul

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

* [PATCH 2/4] ARM: OMAP4 PM: Add IO Daisychain support
@ 2011-10-07 10:03       ` Vishwanath Sripathy
  0 siblings, 0 replies; 24+ messages in thread
From: Vishwanath Sripathy @ 2011-10-07 10:03 UTC (permalink / raw)
  To: linux-arm-kernel

> -----Original Message-----
> From: Paul Walmsley [mailto:paul at pwsan.com]
> Sent: Friday, October 07, 2011 1:44 PM
> To: Vishwanath BS
> Cc: linux-omap at vger.kernel.org; khilman at ti.com; linux-arm-
> kernel at lists.infradead.org; Rajendra Nayak
> Subject: Re: [PATCH 2/4] ARM: OMAP4 PM: Add IO Daisychain support
>
> Hi
>
> some comments:
>
> On Tue, 4 Oct 2011, Vishwanath BS wrote:
>
> > From: Rajendra Nayak <rnayak@ti.com>
> >
> > patch adds IO Daisychain support for OMAP4 as per section 3.9.4 in
> OMAP4430
> > Public TRM.
> >
> > Signed-off-by: Rajendra Nayak <rnayak@ti.com>
> > Signed-off-by: Vishwanath BS <vishwanath.bs@ti.com>
> > ---
> >  arch/arm/mach-omap2/pm.h     |    1 +
> >  arch/arm/mach-omap2/pm44xx.c |   36
> ++++++++++++++++++++++++++++++++++++
> >  2 files changed, 37 insertions(+), 0 deletions(-)
> >
> > diff --git a/arch/arm/mach-omap2/pm.h b/arch/arm/mach-omap2/pm.h
> > index 9a36a7c..2e09d72 100644
> > --- a/arch/arm/mach-omap2/pm.h
> > +++ b/arch/arm/mach-omap2/pm.h
> > @@ -22,6 +22,7 @@ extern int omap3_can_sleep(void);
> >  extern int omap_set_pwrdm_state(struct powerdomain *pwrdm, u32
> state);
> >  extern int omap3_idle_init(void);
> >  extern void omap3_enable_io_chain(void);
> > +extern void omap4_trigger_wuclk_ctrl(void);
> >
> >  #if defined(CONFIG_PM_OPP)
> >  extern int omap3_opp_init(void);
> > diff --git a/arch/arm/mach-omap2/pm44xx.c b/arch/arm/mach-
> omap2/pm44xx.c
> > index 59a870b..aa7cff4 100644
> > --- a/arch/arm/mach-omap2/pm44xx.c
> > +++ b/arch/arm/mach-omap2/pm44xx.c
> > @@ -16,8 +16,17 @@
> >  #include <linux/err.h>
> >  #include <linux/slab.h>
> >
> > +#include <plat/common.h>
> > +
> >  #include "powerdomain.h"
> >  #include <mach/omap4-common.h>
> > +#include "pm.h"
> > +#include "cm-regbits-44xx.h"
> > +#include "cminst44xx.h"
> > +#include "prm-regbits-44xx.h"
> > +#include "prcm44xx.h"
> > +#include "prm44xx.h"
> > +#include "prminst44xx.h"
> >
> >  struct power_state {
> >  	struct powerdomain *pwrdm;
> > @@ -30,6 +39,33 @@ struct power_state {
> >
> >  static LIST_HEAD(pwrst_list);
> >
> > +#define MAX_IOPAD_LATCH_TIME 1000
>
> This macro is missing a comment, which should precede it, describing
> what
> this value is.
OK
>
> > +
> > +void omap4_trigger_wuclk_ctrl(void)
> > +{
> > +	int i = 0;
> > +
> > +	/* Enable GLOBAL_WUEN */
> > +	if (!omap4_cminst_read_inst_reg_bits(OMAP4430_PRM_PARTITION,
> > +			OMAP4430_PRM_DEVICE_INST,
> OMAP4_PRM_IO_PMCTRL_OFFSET,
> > +			OMAP4430_GLOBAL_WUEN_MASK))
>
> The above line doesn't look right.  It's accessing a PRM instance
> register
> with omap4_cminst_*()?  Shouldn't that be omap4_prminst_*()?
Ya, it would make sense to use omap4_prminst_* though functionally both
have the same effect.

>
> > +
> 	omap4_prminst_rmw_inst_reg_bits(OMAP4430_GLOBAL_WUEN_MASK,
> > +			OMAP4430_GLOBAL_WUEN_MASK, OMAP4430_PRM_PARTITION,
> > +			OMAP4430_PRM_DEVICE_INST,
> OMAP4_PRM_IO_PMCTRL_OFFSET);
> > +
> > +	/* Trigger WUCLKIN enable */
> > +	omap4_prminst_rmw_inst_reg_bits(OMAP4430_WUCLK_CTRL_MASK,
> OMAP4430_WUCLK_CTRL_MASK,
> > +		OMAP4430_PRM_PARTITION, OMAP4430_PRM_DEVICE_INST,
> OMAP4_PRM_IO_PMCTRL_OFFSET);
> > +	omap_test_timeout(
> > +		((omap4_prminst_read_inst_reg(OMAP4430_PRM_PARTITION,
> OMAP4430_PRM_DEVICE_INST, OMAP4_PRM_IO_PMCTRL_OFFSET)
> > +		>> OMAP4430_WUCLK_STATUS_SHIFT) == 1),
> > +		MAX_IOPAD_LATCH_TIME, i);
> > +	/* Trigger WUCLKIN disable */
> > +	omap4_prminst_rmw_inst_reg_bits(OMAP4430_WUCLK_CTRL_MASK, 0x0,
> > +		OMAP4430_PRM_PARTITION, OMAP4430_PRM_DEVICE_INST,
> OMAP4_PRM_IO_PMCTRL_OFFSET);
> > +	return;
> > +}
>
> This function belongs in mach-omap2/prminst44xx.c.  I still think it
> would
> be good if we moved all PRM/CM direct register accesses into prm*.c
> or
> cm*.c files in mach-omap2/.  Then none of those prm*.h includes
> would be
> needed in pm44xx.c either.
OK. Let me explore that.

Regards
Vishwa
>
> > +
> >  #ifdef CONFIG_SUSPEND
> >  static int omap4_pm_suspend(void)
> >  {
> > --
> > 1.7.0.4
> >
> > --
> > To unsubscribe from this list: send the line "unsubscribe linux-
> omap" in
> > the body of a message to majordomo at vger.kernel.org
> > More majordomo info at  http://vger.kernel.org/majordomo-info.html
> >
>
>
> - Paul

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

* RE: [PATCH 1/4] ARM: OMAP3 PM: Fix IO Daisychain sequence
  2011-10-07  8:19     ` Paul Walmsley
@ 2011-10-07 10:04       ` Vishwanath Sripathy
  -1 siblings, 0 replies; 24+ messages in thread
From: Vishwanath Sripathy @ 2011-10-07 10:04 UTC (permalink / raw)
  To: Paul Walmsley; +Cc: linux-omap, Kevin Hilman, linux-arm-kernel

> -----Original Message-----
> From: Paul Walmsley [mailto:paul@pwsan.com]
> Sent: Friday, October 07, 2011 1:50 PM
> To: Vishwanath BS
> Cc: linux-omap@vger.kernel.org; khilman@ti.com; linux-arm-
> kernel@lists.infradead.org
> Subject: Re: [PATCH 1/4] ARM: OMAP3 PM: Fix IO Daisychain sequence
>
> Hi
>
> a few comments:
>
> On Tue, 4 Oct 2011, Vishwanath BS wrote:
>
> > As per OMAP3630 TRM Section 3.5.7.2.2, the right sequence for
> enabling IO Daisy
> > chain is "The I/O wake-up scheme is enabled by triggering the I/O
> daisy chain
> > control (Wu clock) by programming a dedicated register
> > (PRCM.PM_WKEN_WKUP[16] EN_IO_CHAIN) in the PRCM module.Software
> must wait for
> > the I/O daisy chain to complete before it transitions the PER
> domain to a
> > nonfunctional state. This is done by polling a dedicated status
> bit in the PRCM
> > module (PRCM.PM_WKST_WKUP[16] ST_IO_CHAIN). This status bit must
> be cleared by
> > software when the bit is read to  1".
> >
> > The original code was polling on a wrong register which is fixed
> in this patch.
> > Also omap3_enable_io_chain is made non static as it's going to be
> used in
> > subsequent patches.
>
> This patch should be split into a fix (for the WKEN/WKST bug) and
> then a
> new patch that drops the 'static'.  The new patch should also move
> this
> function to prm2xxx_3xxx.c for the same reason that the OMAP4
> version of
> this function should be in prminst44xx.c.
OK, Understood.
>
> In the medium-term, a bunch of the functions from prm2xxx_3xxx.c,
> prminst44xx.c, etc. that are only used by the mach-omap2/pm*.c code
> should
> be moved into the PRM driver that Tero is working on that will live
> in
> drivers/.
OK.
Vishwa
>
> >
> > Signed-off-by: Vishwanath BS <vishwanath.bs@ti.com>
> > ---
> >  arch/arm/mach-omap2/pm.h     |    1 +
> >  arch/arm/mach-omap2/pm34xx.c |    6 +++---
> >  2 files changed, 4 insertions(+), 3 deletions(-)
> >
> > diff --git a/arch/arm/mach-omap2/pm.h b/arch/arm/mach-omap2/pm.h
> > index 4e166ad..9a36a7c 100644
> > --- a/arch/arm/mach-omap2/pm.h
> > +++ b/arch/arm/mach-omap2/pm.h
> > @@ -21,6 +21,7 @@ extern void omap_sram_idle(void);
> >  extern int omap3_can_sleep(void);
> >  extern int omap_set_pwrdm_state(struct powerdomain *pwrdm, u32
> state);
> >  extern int omap3_idle_init(void);
> > +extern void omap3_enable_io_chain(void);
> >
> >  #if defined(CONFIG_PM_OPP)
> >  extern int omap3_opp_init(void);
> > diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-
> omap2/pm34xx.c
> > index 7255d9b..61f1a5b 100644
> > --- a/arch/arm/mach-omap2/pm34xx.c
> > +++ b/arch/arm/mach-omap2/pm34xx.c
> > @@ -95,7 +95,7 @@ static inline void
> omap3_per_restore_context(void)
> >  	omap_gpio_restore_context();
> >  }
> >
> > -static void omap3_enable_io_chain(void)
> > +void omap3_enable_io_chain(void)
> >  {
> >  	int timeout = 0;
> >
> > @@ -105,7 +105,7 @@ static void omap3_enable_io_chain(void)
> >  		/* Do a readback to assure write has been done */
> >  		omap2_prm_read_mod_reg(WKUP_MOD, PM_WKEN);
> >
> > -		while (!(omap2_prm_read_mod_reg(WKUP_MOD, PM_WKEN) &
> > +		while (!(omap2_prm_read_mod_reg(WKUP_MOD, PM_WKST) &
> >  			 OMAP3430_ST_IO_CHAIN_MASK)) {
> >  			timeout++;
> >  			if (timeout > 1000) {
> > @@ -114,7 +114,7 @@ static void omap3_enable_io_chain(void)
> >  				return;
> >  			}
> >
> 	omap2_prm_set_mod_reg_bits(OMAP3430_ST_IO_CHAIN_MASK,
> > -					     WKUP_MOD, PM_WKEN);
> > +					     WKUP_MOD, PM_WKST);
> >  		}
> >  	}
> >  }
> > --
> > 1.7.0.4
> >
> > --
> > To unsubscribe from this list: send the line "unsubscribe linux-
> omap" in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at  http://vger.kernel.org/majordomo-info.html
> >
>
>
> - Paul

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

* [PATCH 1/4] ARM: OMAP3 PM: Fix IO Daisychain sequence
@ 2011-10-07 10:04       ` Vishwanath Sripathy
  0 siblings, 0 replies; 24+ messages in thread
From: Vishwanath Sripathy @ 2011-10-07 10:04 UTC (permalink / raw)
  To: linux-arm-kernel

> -----Original Message-----
> From: Paul Walmsley [mailto:paul at pwsan.com]
> Sent: Friday, October 07, 2011 1:50 PM
> To: Vishwanath BS
> Cc: linux-omap at vger.kernel.org; khilman at ti.com; linux-arm-
> kernel at lists.infradead.org
> Subject: Re: [PATCH 1/4] ARM: OMAP3 PM: Fix IO Daisychain sequence
>
> Hi
>
> a few comments:
>
> On Tue, 4 Oct 2011, Vishwanath BS wrote:
>
> > As per OMAP3630 TRM Section 3.5.7.2.2, the right sequence for
> enabling IO Daisy
> > chain is "The I/O wake-up scheme is enabled by triggering the I/O
> daisy chain
> > control (Wu clock) by programming a dedicated register
> > (PRCM.PM_WKEN_WKUP[16] EN_IO_CHAIN) in the PRCM module.Software
> must wait for
> > the I/O daisy chain to complete before it transitions the PER
> domain to a
> > nonfunctional state. This is done by polling a dedicated status
> bit in the PRCM
> > module (PRCM.PM_WKST_WKUP[16] ST_IO_CHAIN). This status bit must
> be cleared by
> > software when the bit is read to  1".
> >
> > The original code was polling on a wrong register which is fixed
> in this patch.
> > Also omap3_enable_io_chain is made non static as it's going to be
> used in
> > subsequent patches.
>
> This patch should be split into a fix (for the WKEN/WKST bug) and
> then a
> new patch that drops the 'static'.  The new patch should also move
> this
> function to prm2xxx_3xxx.c for the same reason that the OMAP4
> version of
> this function should be in prminst44xx.c.
OK, Understood.
>
> In the medium-term, a bunch of the functions from prm2xxx_3xxx.c,
> prminst44xx.c, etc. that are only used by the mach-omap2/pm*.c code
> should
> be moved into the PRM driver that Tero is working on that will live
> in
> drivers/.
OK.
Vishwa
>
> >
> > Signed-off-by: Vishwanath BS <vishwanath.bs@ti.com>
> > ---
> >  arch/arm/mach-omap2/pm.h     |    1 +
> >  arch/arm/mach-omap2/pm34xx.c |    6 +++---
> >  2 files changed, 4 insertions(+), 3 deletions(-)
> >
> > diff --git a/arch/arm/mach-omap2/pm.h b/arch/arm/mach-omap2/pm.h
> > index 4e166ad..9a36a7c 100644
> > --- a/arch/arm/mach-omap2/pm.h
> > +++ b/arch/arm/mach-omap2/pm.h
> > @@ -21,6 +21,7 @@ extern void omap_sram_idle(void);
> >  extern int omap3_can_sleep(void);
> >  extern int omap_set_pwrdm_state(struct powerdomain *pwrdm, u32
> state);
> >  extern int omap3_idle_init(void);
> > +extern void omap3_enable_io_chain(void);
> >
> >  #if defined(CONFIG_PM_OPP)
> >  extern int omap3_opp_init(void);
> > diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-
> omap2/pm34xx.c
> > index 7255d9b..61f1a5b 100644
> > --- a/arch/arm/mach-omap2/pm34xx.c
> > +++ b/arch/arm/mach-omap2/pm34xx.c
> > @@ -95,7 +95,7 @@ static inline void
> omap3_per_restore_context(void)
> >  	omap_gpio_restore_context();
> >  }
> >
> > -static void omap3_enable_io_chain(void)
> > +void omap3_enable_io_chain(void)
> >  {
> >  	int timeout = 0;
> >
> > @@ -105,7 +105,7 @@ static void omap3_enable_io_chain(void)
> >  		/* Do a readback to assure write has been done */
> >  		omap2_prm_read_mod_reg(WKUP_MOD, PM_WKEN);
> >
> > -		while (!(omap2_prm_read_mod_reg(WKUP_MOD, PM_WKEN) &
> > +		while (!(omap2_prm_read_mod_reg(WKUP_MOD, PM_WKST) &
> >  			 OMAP3430_ST_IO_CHAIN_MASK)) {
> >  			timeout++;
> >  			if (timeout > 1000) {
> > @@ -114,7 +114,7 @@ static void omap3_enable_io_chain(void)
> >  				return;
> >  			}
> >
> 	omap2_prm_set_mod_reg_bits(OMAP3430_ST_IO_CHAIN_MASK,
> > -					     WKUP_MOD, PM_WKEN);
> > +					     WKUP_MOD, PM_WKST);
> >  		}
> >  	}
> >  }
> > --
> > 1.7.0.4
> >
> > --
> > To unsubscribe from this list: send the line "unsubscribe linux-
> omap" in
> > the body of a message to majordomo at vger.kernel.org
> > More majordomo info at  http://vger.kernel.org/majordomo-info.html
> >
>
>
> - Paul

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

end of thread, other threads:[~2011-10-07 10:04 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-10-04 17:52 [PATCH 0/4] ARM: OMAP3PLUS PM: Add IO Daisychain support via hwmod mux Vishwanath BS
2011-10-04 17:52 ` Vishwanath BS
2011-10-04 17:52 ` [PATCH 1/4] ARM: OMAP3 PM: Fix IO Daisychain sequence Vishwanath BS
2011-10-04 17:52   ` Vishwanath BS
2011-10-04 18:54   ` Tony Lindgren
2011-10-04 18:54     ` Tony Lindgren
2011-10-04 20:47   ` Kevin Hilman
2011-10-04 20:47     ` Kevin Hilman
2011-10-05  4:19     ` Vishwanath Sripathy
2011-10-05  4:19       ` Vishwanath Sripathy
2011-10-07  8:19   ` Paul Walmsley
2011-10-07  8:19     ` Paul Walmsley
2011-10-07 10:04     ` Vishwanath Sripathy
2011-10-07 10:04       ` Vishwanath Sripathy
2011-10-04 17:52 ` [PATCH 2/4] ARM: OMAP4 PM: Add IO Daisychain support Vishwanath BS
2011-10-04 17:52   ` Vishwanath BS
2011-10-07  8:13   ` Paul Walmsley
2011-10-07  8:13     ` Paul Walmsley
2011-10-07 10:03     ` Vishwanath Sripathy
2011-10-07 10:03       ` Vishwanath Sripathy
2011-10-04 17:52 ` [PATCH 3/4] ARM: OMAP3 PM: Enable IO Wake up Vishwanath BS
2011-10-04 17:52   ` Vishwanath BS
2011-10-04 17:52 ` [PATCH 4/4] ARM: OMAP3PLUS PM: Add IO Daisychain support via hwmod mux Vishwanath BS
2011-10-04 17:52   ` Vishwanath BS

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.