Skip to contentSkip to conversation

ARM: OMAP3PLUS PM: Add IO Daisychain support via hwmod mux

PATCH Superseded Vishwanath BS 4 participants 12 messages Oct 4, 2011 – Oct 7, 2011

Subsystems (5)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover ARM: OMAP3PLUS PM: Add IO Daisychain support via hwmod mux

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(-)
#1 lore raw

PATCH 1/4 ARM: OMAP3 PM: Fix IO Daisychain sequence

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.

---
 arch/arm/mach-omap2/pm.h     |    1 +
 arch/arm/mach-omap2/pm34xx.c |    6 +++---
 2 files changed, 4 insertions(+), 3 deletions(-)
arch/arm/mach-omap2/pm.h +1 -0
index 4e166ad..9a36a7c 100644
@@ -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);
arch/arm/mach-omap2/pm34xx.c +3 -3
index 7255d9b..61f1a5b 100644
@@ -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);
 		}
 	}
 }
Signature · 1 line
1.7.0.4
maintainer
#2 lore raw

PATCH 1/4 ARM: OMAP3 PM: Fix IO Daisychain sequence

arch/arm/mach-omap2/pm34xx.c static void omap3_enable_io_chain(void) · line 111

Quoted 9 lines · Vishwanath BS
arch/arm/mach-omap2/pm34xx.c +1 -1
@@ -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..

arch/arm/mach-omap2/pm34xx.c static void omap3_enable_io_chain(void) · line 120

Quoted 9 lines
arch/arm/mach-omap2/pm34xx.c +1 -1
@@ -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

#3 lore raw

PATCH 1/4 ARM: OMAP3 PM: Fix IO Daisychain sequence

In reply to Vishwanath BS

Hi Vishwa,

Quoted 9 lines · 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".

Quoted 5 lines

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.

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

#4 lore raw

PATCH 1/4 ARM: OMAP3 PM: Fix IO Daisychain sequence

Quoted 35 lines

-----Original Message-----
From: Kevin Hilman [mailto:[email protected]]
Sent: Wednesday, October 05, 2011 2:18 AM
To: Vishwanath BS
Cc: [email protected]; linux-arm- [email protected]; [email protected]
Subject: Re: [PATCH 1/4] ARM: OMAP3 PM: Fix IO Daisychain sequence

Hi Vishwa,

Quoted 1 line · Vishwanath BS

As per OMAP3630 TRM Section 3.5.7.2.2, the right sequence for

enabling IO Daisy

Quoted 1 line

chain is "The I/O wake-up scheme is enabled by triggering the I/O

daisy chain

Quoted 2 lines

control (Wu clock) by programming a dedicated register (PRCM.PM_WKEN_WKUP[16] EN_IO_CHAIN) in the PRCM module.Software

must wait for

Quoted 1 line

the I/O daisy chain to complete before it transitions the PER

domain to a

Quoted 1 line

nonfunctional state. This is done by polling a dedicated status

bit in the PRCM

Quoted 1 line

module (PRCM.PM_WKST_WKUP[16] ST_IO_CHAIN). This status bit must

be cleared by

Quoted 3 lines

software when the bit is read to 1".

The original code was polling on a wrong register which is fixed

in this patch.

Quoted 1 line

Also omap3_enable_io_chain is made non static as it's going to be

used in

Quoted 3 lines

subsequent patches.

Quoted 7 lines

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

Quoted 6 lines

Thanks,

Kevin

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

maintainer
#5 lore raw

PATCH 1/4 ARM: OMAP3 PM: Fix IO Daisychain sequence

In reply to Vishwanath BS

Hi

a few comments:

Quoted 9 lines · 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".

Quoted 3 lines

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/.

Quoted 58 lines
---
 arch/arm/mach-omap2/pm.h     |    1 +
 arch/arm/mach-omap2/pm34xx.c |    6 +++---
 2 files changed, 4 insertions(+), 3 deletions(-)
arch/arm/mach-omap2/pm.h +1 -0
index 4e166ad..9a36a7c 100644
@@ -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);
arch/arm/mach-omap2/pm34xx.c +3 -3
index 7255d9b..61f1a5b 100644
@@ -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);
 		}
 	}
 }
Signature · 6 lines
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

#6 lore raw

PATCH 1/4 ARM: OMAP3 PM: Fix IO Daisychain sequence

Quoted 35 lines

-----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:

Quoted 1 line · Vishwanath BS

As per OMAP3630 TRM Section 3.5.7.2.2, the right sequence for

enabling IO Daisy

Quoted 1 line

chain is "The I/O wake-up scheme is enabled by triggering the I/O

daisy chain

Quoted 2 lines

control (Wu clock) by programming a dedicated register (PRCM.PM_WKEN_WKUP[16] EN_IO_CHAIN) in the PRCM module.Software

must wait for

Quoted 1 line

the I/O daisy chain to complete before it transitions the PER

domain to a

Quoted 1 line

nonfunctional state. This is done by polling a dedicated status

bit in the PRCM

Quoted 1 line

module (PRCM.PM_WKST_WKUP[16] ST_IO_CHAIN). This status bit must

be cleared by

Quoted 3 lines

software when the bit is read to 1".

The original code was polling on a wrong register which is fixed

in this patch.

Quoted 1 line

Also omap3_enable_io_chain is made non static as it's going to be

used in

Quoted 1 line

subsequent patches.

Quoted 7 lines

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.

Quoted 7 lines

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

Quoted 67 lines
Quoted 13 lines
---
 arch/arm/mach-omap2/pm.h     |    1 +
 arch/arm/mach-omap2/pm34xx.c |    6 +++---
 2 files changed, 4 insertions(+), 3 deletions(-)
arch/arm/mach-omap2/pm.h +0 -0
index 4e166ad..9a36a7c 100644

arch/arm/mach-omap2/pm.h extern void omap_sram_idle(void); · line 22

Quoted 2 lines
arch/arm/mach-omap2/pm.h +0 -0
@@ -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);

arch/arm/mach-

Quoted 6 lines
arch/arm/mach-omap2/pm.h +1 -0
 extern int omap3_idle_init(void);
+extern void omap3_enable_io_chain(void);
 
 #if defined(CONFIG_PM_OPP)
 extern int omap3_opp_init(void);
arch/arm/mach- renamed from arch/arm/mach-omap2/pm34xx.c +0 -0

omap2/pm34xx.c

arch/arm/mach-omap2/pm34xx.c static inline void

Quoted 4 lines

index 7255d9b..61f1a5b 100644

arch/arm/mach-omap2/pm34xx.c +0 -0
@@ -95,7 +95,7 @@ static inline void

omap3_per_restore_context(void)

Quoted 18 lines
arch/arm/mach-omap2/pm34xx.c +2 -2
 	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) {

arch/arm/mach-omap2/pm34xx.c static void omap3_enable_io_chain(void) · line 116

Quoted 3 lines
arch/arm/mach-omap2/pm34xx.c +0 -0
@@ -114,7 +114,7 @@ static void omap3_enable_io_chain(void)
 				return;
 			}
 
	omap2_prm_set_mod_reg_bits(OMAP3430_ST_IO_CHAIN_MASK,
Quoted 10 lines
arch/arm/mach-omap2/pm34xx.c +1 -2
-					     WKUP_MOD, PM_WKEN);
+					     WKUP_MOD, PM_WKST);
 		}
 	}
 }
--

1.7.0.4

--
To unsubscribe from this list: send the line "unsubscribe linux-

omap" in

Quoted 3 lines

the body of a message to majordomo at vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html

- Paul

#7 lore raw

PATCH 2/4 ARM: OMAP4 PM: Add IO Daisychain support

In reply to Vishwanath BS

From: Rajendra Nayak <[email protected]>

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

---
 arch/arm/mach-omap2/pm.h     |    1 +
 arch/arm/mach-omap2/pm44xx.c |   36 ++++++++++++++++++++++++++++++++++++
 2 files changed, 37 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/pm.h +1 -0
index 9a36a7c..2e09d72 100644
@@ -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);
arch/arm/mach-omap2/pm44xx.c +36 -0
index 59a870b..aa7cff4 100644
@@ -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)
 {
Signature · 1 line
1.7.0.4
maintainer
#8 lore raw

PATCH 2/4 ARM: OMAP4 PM: Add IO Daisychain support

Hi

some comments:

Quoted 47 lines · Vishwanath BS

From: Rajendra Nayak <[email protected]>

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

---
 arch/arm/mach-omap2/pm.h     |    1 +
 arch/arm/mach-omap2/pm44xx.c |   36 ++++++++++++++++++++++++++++++++++++
 2 files changed, 37 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/pm.h +1 -0
index 9a36a7c..2e09d72 100644
@@ -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);
arch/arm/mach-omap2/pm44xx.c +9 -0
index 59a870b..aa7cff4 100644
@@ -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;

arch/arm/mach-omap2/pm44xx.c struct power_state { · line 42

Quoted 4 lines
arch/arm/mach-omap2/pm44xx.c +1 -0
@@ -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.

arch/arm/mach-omap2/pm44xx.c struct power_state { · line 51

Quoted 9 lines
arch/arm/mach-omap2/pm44xx.c +9 -0
+
+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_*()?

Quoted 6 lines
arch/arm/mach-omap2/pm44xx.c +6 -0
+		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,

arch/arm/mach-omap2/pm44xx.c struct power_state { · line 67

Quoted 10 lines
arch/arm/mach-omap2/pm44xx.c +10 -0
+		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.

Quoted 12 lines
arch/arm/mach-omap2/pm44xx.c +1 -0
+
 #ifdef CONFIG_SUSPEND
 static int omap4_pm_suspend(void)
 {
Signature · 6 lines
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

#9 lore raw

PATCH 2/4 ARM: OMAP4 PM: Add IO Daisychain support

Quoted 66 lines

-----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:

Quoted 3 lines · Vishwanath BS

From: Rajendra Nayak <[email protected]>

patch adds IO Daisychain support for OMAP4 as per section 3.9.4 in

OMAP4430

Quoted 7 lines

Public TRM.

---
 arch/arm/mach-omap2/pm.h     |    1 +
 arch/arm/mach-omap2/pm44xx.c |   36

++++++++++++++++++++++++++++++++++++

arch/arm/mach-omap2/pm.h extern int omap3_can_sleep(void); · line 22

Quoted 8 lines
 2 files changed, 37 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/pm.h +0 -0
index 9a36a7c..2e09d72 100644
@@ -22,6 +22,7 @@ extern int omap3_can_sleep(void);
 extern int omap_set_pwrdm_state(struct powerdomain *pwrdm, u32

state);

arch/arm/mach-

Quoted 7 lines
arch/arm/mach-omap2/pm.h +1 -0
 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);
arch/arm/mach- renamed from arch/arm/mach-omap2/pm44xx.c +0 -0

omap2/pm44xx.c

Quoted 23 lines

index 59a870b..aa7cff4 100644

arch/arm/mach-omap2/pm44xx.c +9 -0
@@ -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 {
 
Quoted 7 lines

arch/arm/mach-omap2/pm44xx.c struct power_state { · line 42

Quoted 3 lines
arch/arm/mach-omap2/pm44xx.c +1 -0
 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

Quoted 10 lines

arch/arm/mach-omap2/pm44xx.c struct power_state {

Quoted 9 lines
arch/arm/mach-omap2/pm44xx.c +8 -0
+
+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,

Quoted 5 lines

arch/arm/mach-omap2/pm44xx.c struct power_state { · line 51

Quoted 1 line
arch/arm/mach-omap2/pm44xx.c +1 -0
+			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.

Quoted 21 lines

arch/arm/mach-omap2/pm44xx.c struct power_state { · line 52

Quoted 2 lines
arch/arm/mach-omap2/pm44xx.c +1 -0
+
	omap4_prminst_rmw_inst_reg_bits(OMAP4430_GLOBAL_WUEN_MASK,

arch/arm/mach-omap2/pm44xx.c struct power_state { · line 54

Quoted 2 lines
arch/arm/mach-omap2/pm44xx.c +2 -0
+			OMAP4430_GLOBAL_WUEN_MASK, OMAP4430_PRM_PARTITION,
+			OMAP4430_PRM_DEVICE_INST,

OMAP4_PRM_IO_PMCTRL_OFFSET);

arch/arm/mach-omap2/pm44xx.c struct power_state {

Quoted 3 lines
arch/arm/mach-omap2/pm44xx.c +3 -0
+
+	/* Trigger WUCLKIN enable */
+	omap4_prminst_rmw_inst_reg_bits(OMAP4430_WUCLK_CTRL_MASK,

OMAP4430_WUCLK_CTRL_MASK,

arch/arm/mach-omap2/pm44xx.c struct power_state { · line 58

Quoted 1 line
arch/arm/mach-omap2/pm44xx.c +1 -0
+		OMAP4430_PRM_PARTITION, OMAP4430_PRM_DEVICE_INST,

OMAP4_PRM_IO_PMCTRL_OFFSET);

arch/arm/mach-omap2/pm44xx.c struct power_state { · line 60

Quoted 2 lines
arch/arm/mach-omap2/pm44xx.c +2 -0
+	omap_test_timeout(
+		((omap4_prminst_read_inst_reg(OMAP4430_PRM_PARTITION,

OMAP4430_PRM_DEVICE_INST, OMAP4_PRM_IO_PMCTRL_OFFSET)

arch/arm/mach-omap2/pm44xx.c struct power_state {

Quoted 5 lines
arch/arm/mach-omap2/pm44xx.c +5 -0
+		>> 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);

Quoted 10 lines

arch/arm/mach-omap2/pm44xx.c struct power_state { · line 67

Quoted 2 lines
arch/arm/mach-omap2/pm44xx.c +2 -0
+	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

Quoted 17 lines
Quoted 10 lines
arch/arm/mach-omap2/pm44xx.c +1 -1
+
 #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

Quoted 3 lines

the body of a message to majordomo at vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html

- Paul

#10 lore raw

PATCH 3/4 ARM: OMAP3 PM: Enable IO Wake up

In reply to 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.

---
 arch/arm/mach-omap2/pm34xx.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/pm34xx.c +3 -0
index 61f1a5b..6c80988 100644
@@ -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");
Signature · 1 line
1.7.0.4
#11 lore raw

PATCH 4/4 ARM: OMAP3PLUS PM: Add IO Daisychain support via hwmod mux

In reply to 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.

---
 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(-)
arch/arm/mach-omap2/omap_hwmod.c +7 -2
index 84cc0bd..070f3f5 100644
@@ -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;
 
arch/arm/mach-omap2/pm.c +9 -0
index 3feb359..c3295fe 100644
@@ -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
arch/arm/mach-omap2/pm.h +2 -1
index 2e09d72..9784d81 100644
@@ -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);
arch/arm/mach-omap2/pm34xx.c +2 -24
index 6c80988..6417ccb 100644
@@ -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]);
Signature · 1 line
1.7.0.4