Re: [PATCH 2/6] ARM: OMAP4 PM: Add IO Daisychain support

2012-02-24 Thread Shilimkar, Santosh
On Fri, Feb 24, 2012 at 12:29 PM, Rajendra Nayak rna...@ti.com wrote:
 On Thursday 23 February 2012 07:18 PM, Shilimkar, Santosh wrote:

 On Thu, Feb 23, 2012 at 6:51 PM, Tero Kristot-kri...@ti.com  wrote:

 [..]


 +/**
 + * Maximum time(us) it takes to output the signal WUCLKOUT of the last
 pad of
 + * the I/O ring after asserting WUCLKIN high
 + */
 +#define MAX_IOPAD_LATCH_TIME 1000
 +

 Is the 1000 us/ms ?


 1000 us.


 Is that documented or arbitrary chosen ?


 looks like it was arbitrarily chosen as there's no documentation
 on the worst case delay. I spoke to Nilesh (copied) and he suggested
 using a value close to 100us instead which should be quite safe.
 1000us according to him is really very high.
 however there does not seem to be any documented value available for
 this in any of the specs.

Thanks for clarification Rajendra.

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


RE: [PATCH 2/6] ARM: OMAP4 PM: Add IO Daisychain support

2012-02-23 Thread Elaidi, Djamil
Hi Kristo,

I think you must also add a omap_test_timeout() check after the Trigger WUCLKIN 
disable, to verify WUCLK_STATUS has come back to 0.
This is needed because the IO daisy chain will not be ready until the WUCLKIN 
falling edge has propagated.

+   /* Trigger WUCLKIN disable */
+   omap4_prm_rmw_inst_reg_bits(OMAP4430_WUCLK_CTRL_MASK, 0x0,
+   OMAP4430_PRM_DEVICE_INST, OMAP4_PRM_IO_PMCTRL_OFFSET);
+   return;
+   omap_test_timeout(
+   (((omap4_prm_read_inst_reg(OMAP4430_PRM_DEVICE_INST,
+   OMAP4_PRM_IO_PMCTRL_OFFSET) 
+   OMAP4430_WUCLK_STATUS_MASK) 
+   OMAP4430_WUCLK_STATUS_SHIFT) == 0),
+   MAX_IOPAD_LATCH_TIME, i);


Best regards
Djamil ELAÏDI
+33 4 97 27 50 97
Software Systems Engineer
OMAP Platform Business Unit - PSI Modem Integration
Texas Instruments


Texas Instruments France SA, 821 Avenue Jack Kilby, 06270 Villeneuve Loubet. 
036 420 040 R.C.S Antibes. Capital de EUR 753.920

-Original Message-
From: linux-omap-ow...@vger.kernel.org 
[mailto:linux-omap-ow...@vger.kernel.org] On Behalf Of Kristo, Tero
Sent: jeudi 23 février 2012 14:22
To: linux-omap@vger.kernel.org; Hilman, Kevin
Cc: linux-arm-ker...@lists.infradead.org; Nayak, Rajendra; Sripathy, Vishwanath
Subject: [PATCH 2/6] ARM: OMAP4 PM: Add IO Daisychain support

From: Rajendra Nayak rna...@ti.com

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

Signed-off-by: Rajendra Nayak rna...@ti.com
Signed-off-by: Vishwanath BS vishwanath...@ti.com
Signed-off-by: Tero Kristo t-kri...@ti.com
---
 arch/arm/mach-omap2/prm44xx.c |   32 
 arch/arm/mach-omap2/prm44xx.h |1 +
 2 files changed, 33 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/prm44xx.c b/arch/arm/mach-omap2/prm44xx.c
index 33dd655..1557647 100644
--- a/arch/arm/mach-omap2/prm44xx.c
+++ b/arch/arm/mach-omap2/prm44xx.c
@@ -230,6 +230,41 @@ void omap44xx_prm_restore_irqen(u32 *saved_mask)
 OMAP4_PRM_IRQENABLE_MPU_2_OFFSET);
 }

+/**
+ * Maximum time(us) it takes to output the signal WUCLKOUT of the last pad of
+ * the I/O ring after asserting WUCLKIN high
+ */
+#define MAX_IOPAD_LATCH_TIME 1000
+
+/* OMAP4 IO Daisychain trigger sequence */
+void omap4_trigger_wuclk_ctrl(void)
+{
+   int i = 0;
+
+   /* Enable GLOBAL_WUEN */
+   if (!(omap4_prm_read_inst_reg(OMAP4430_PRM_DEVICE_INST,
+   OMAP4_PRM_IO_PMCTRL_OFFSET)  OMAP4430_GLOBAL_WUEN_MASK))
+   omap4_prm_rmw_inst_reg_bits(OMAP4430_GLOBAL_WUEN_MASK,
+   OMAP4430_GLOBAL_WUEN_MASK, OMAP4430_PRM_DEVICE_INST,
+   OMAP4_PRM_IO_PMCTRL_OFFSET);
+
+   /* Trigger WUCLKIN enable */
+   omap4_prm_rmw_inst_reg_bits(OMAP4430_WUCLK_CTRL_MASK,
+   OMAP4430_WUCLK_CTRL_MASK, OMAP4430_PRM_DEVICE_INST,
+   OMAP4_PRM_IO_PMCTRL_OFFSET);
+   omap_test_timeout(
+   (((omap4_prm_read_inst_reg(OMAP4430_PRM_DEVICE_INST,
+   OMAP4_PRM_IO_PMCTRL_OFFSET) 
+   OMAP4430_WUCLK_STATUS_MASK) 
+   OMAP4430_WUCLK_STATUS_SHIFT) == 1),
+   MAX_IOPAD_LATCH_TIME, i);
+
+   /* Trigger WUCLKIN disable */
+   omap4_prm_rmw_inst_reg_bits(OMAP4430_WUCLK_CTRL_MASK, 0x0,
+   OMAP4430_PRM_DEVICE_INST, OMAP4_PRM_IO_PMCTRL_OFFSET);
+   return;
+}
+
 static int __init omap4xxx_prcm_init(void)
 {
if (cpu_is_omap44xx())
diff --git a/arch/arm/mach-omap2/prm44xx.h b/arch/arm/mach-omap2/prm44xx.h
index 7978092..a840f0f 100644
--- a/arch/arm/mach-omap2/prm44xx.h
+++ b/arch/arm/mach-omap2/prm44xx.h
@@ -762,6 +762,7 @@ void omap4_prm_vp_clear_txdone(u8 vp_id);
 extern u32 omap4_prm_vcvp_read(u8 offset);
 extern void omap4_prm_vcvp_write(u32 val, u8 offset);
 extern u32 omap4_prm_vcvp_rmw(u32 mask, u32 bits, u8 offset);
+extern void omap4_trigger_wuclk_ctrl(void);

 /* PRM interrupt-related functions */
 extern void omap44xx_prm_read_pending_irqs(unsigned long *events);
--
1.7.4.1

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

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


Re: [PATCH 2/6] ARM: OMAP4 PM: Add IO Daisychain support

2012-02-23 Thread Rajendra Nayak

Djamil,

On Thursday 23 February 2012 09:28 PM, Elaidi, Djamil wrote:

Hi Kristo,

I think you must also add a omap_test_timeout() check after the Trigger WUCLKIN 
disable, to verify WUCLK_STATUS has come back to 0.
This is needed because the IO daisy chain will not be ready until the WUCLKIN 
falling edge has propagated.


You are right, this was missed and needs to be added.
Thanks for the review.

regards,
Rajendra



+   /* Trigger WUCLKIN disable */
+   omap4_prm_rmw_inst_reg_bits(OMAP4430_WUCLK_CTRL_MASK, 0x0,
+   OMAP4430_PRM_DEVICE_INST, OMAP4_PRM_IO_PMCTRL_OFFSET);
+   return;
+   omap_test_timeout(
+   (((omap4_prm_read_inst_reg(OMAP4430_PRM_DEVICE_INST,
+   OMAP4_PRM_IO_PMCTRL_OFFSET)
+   OMAP4430_WUCLK_STATUS_MASK)
+   OMAP4430_WUCLK_STATUS_SHIFT) == 0),
+   MAX_IOPAD_LATCH_TIME, i);


Best regards
Djamil ELAÏDI
+33 4 97 27 50 97
Software Systems Engineer
OMAP Platform Business Unit - PSI Modem Integration
Texas Instruments

-Original Message-
From: linux-omap-ow...@vger.kernel.org 
[mailto:linux-omap-ow...@vger.kernel.org] On Behalf Of Kristo, Tero
Sent: jeudi 23 février 2012 14:22
To: linux-omap@vger.kernel.org; Hilman, Kevin
Cc: linux-arm-ker...@lists.infradead.org; Nayak, Rajendra; Sripathy, Vishwanath
Subject: [PATCH 2/6] ARM: OMAP4 PM: Add IO Daisychain support

From: Rajendra Nayakrna...@ti.com

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

Signed-off-by: Rajendra Nayakrna...@ti.com
Signed-off-by: Vishwanath BSvishwanath...@ti.com
Signed-off-by: Tero Kristot-kri...@ti.com
---
  arch/arm/mach-omap2/prm44xx.c |   32 
  arch/arm/mach-omap2/prm44xx.h |1 +
  2 files changed, 33 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/prm44xx.c b/arch/arm/mach-omap2/prm44xx.c
index 33dd655..1557647 100644
--- a/arch/arm/mach-omap2/prm44xx.c
+++ b/arch/arm/mach-omap2/prm44xx.c
@@ -230,6 +230,41 @@ void omap44xx_prm_restore_irqen(u32 *saved_mask)
 OMAP4_PRM_IRQENABLE_MPU_2_OFFSET);
  }

+/**
+ * Maximum time(us) it takes to output the signal WUCLKOUT of the last pad of
+ * the I/O ring after asserting WUCLKIN high
+ */
+#define MAX_IOPAD_LATCH_TIME 1000
+
+/* OMAP4 IO Daisychain trigger sequence */
+void omap4_trigger_wuclk_ctrl(void)
+{
+   int i = 0;
+
+   /* Enable GLOBAL_WUEN */
+   if (!(omap4_prm_read_inst_reg(OMAP4430_PRM_DEVICE_INST,
+   OMAP4_PRM_IO_PMCTRL_OFFSET)  OMAP4430_GLOBAL_WUEN_MASK))
+   omap4_prm_rmw_inst_reg_bits(OMAP4430_GLOBAL_WUEN_MASK,
+   OMAP4430_GLOBAL_WUEN_MASK, OMAP4430_PRM_DEVICE_INST,
+   OMAP4_PRM_IO_PMCTRL_OFFSET);
+
+   /* Trigger WUCLKIN enable */
+   omap4_prm_rmw_inst_reg_bits(OMAP4430_WUCLK_CTRL_MASK,
+   OMAP4430_WUCLK_CTRL_MASK, OMAP4430_PRM_DEVICE_INST,
+   OMAP4_PRM_IO_PMCTRL_OFFSET);
+   omap_test_timeout(
+   (((omap4_prm_read_inst_reg(OMAP4430_PRM_DEVICE_INST,
+   OMAP4_PRM_IO_PMCTRL_OFFSET)
+   OMAP4430_WUCLK_STATUS_MASK)
+   OMAP4430_WUCLK_STATUS_SHIFT) == 1),
+   MAX_IOPAD_LATCH_TIME, i);
+
+   /* Trigger WUCLKIN disable */
+   omap4_prm_rmw_inst_reg_bits(OMAP4430_WUCLK_CTRL_MASK, 0x0,
+   OMAP4430_PRM_DEVICE_INST, OMAP4_PRM_IO_PMCTRL_OFFSET);
+   return;
+}
+
  static int __init omap4xxx_prcm_init(void)
  {
if (cpu_is_omap44xx())
diff --git a/arch/arm/mach-omap2/prm44xx.h b/arch/arm/mach-omap2/prm44xx.h
index 7978092..a840f0f 100644
--- a/arch/arm/mach-omap2/prm44xx.h
+++ b/arch/arm/mach-omap2/prm44xx.h
@@ -762,6 +762,7 @@ void omap4_prm_vp_clear_txdone(u8 vp_id);
  extern u32 omap4_prm_vcvp_read(u8 offset);
  extern void omap4_prm_vcvp_write(u32 val, u8 offset);
  extern u32 omap4_prm_vcvp_rmw(u32 mask, u32 bits, u8 offset);
+extern void omap4_trigger_wuclk_ctrl(void);

  /* PRM interrupt-related functions */
  extern void omap44xx_prm_read_pending_irqs(unsigned long *events);


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


Re: [PATCH 2/6] ARM: OMAP4 PM: Add IO Daisychain support

2012-02-23 Thread Rajendra Nayak

On Thursday 23 February 2012 07:18 PM, Shilimkar, Santosh wrote:

On Thu, Feb 23, 2012 at 6:51 PM, Tero Kristot-kri...@ti.com  wrote:

[..]


+/**
+ * Maximum time(us) it takes to output the signal WUCLKOUT of the last pad of
+ * the I/O ring after asserting WUCLKIN high
+ */
+#define MAX_IOPAD_LATCH_TIME 1000
+

Is the 1000 us/ms ?


1000 us.


Is that documented or arbitrary chosen ?


looks like it was arbitrarily chosen as there's no documentation
on the worst case delay. I spoke to Nilesh (copied) and he suggested
using a value close to 100us instead which should be quite safe.
1000us according to him is really very high.
however there does not seem to be any documented value available for
this in any of the specs.



Rest of the change looks good to me.

regards
santosh


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


Re: [PATCH 2/6] ARM: OMAP4 PM: Add IO Daisychain support

2012-02-23 Thread Shilimkar, Santosh
On Thu, Feb 23, 2012 at 6:51 PM, Tero Kristo t-kri...@ti.com wrote:
 From: Rajendra Nayak rna...@ti.com

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

A brief about IO daisy in changelog would be good apart from TRM reference.

 Signed-off-by: Rajendra Nayak rna...@ti.com
 Signed-off-by: Vishwanath BS vishwanath...@ti.com
 Signed-off-by: Tero Kristo t-kri...@ti.com
 ---
  arch/arm/mach-omap2/prm44xx.c |   32 
  arch/arm/mach-omap2/prm44xx.h |    1 +
  2 files changed, 33 insertions(+), 0 deletions(-)

 diff --git a/arch/arm/mach-omap2/prm44xx.c b/arch/arm/mach-omap2/prm44xx.c
 index 33dd655..1557647 100644
 --- a/arch/arm/mach-omap2/prm44xx.c
 +++ b/arch/arm/mach-omap2/prm44xx.c
 @@ -230,6 +230,41 @@ void omap44xx_prm_restore_irqen(u32 *saved_mask)
                                 OMAP4_PRM_IRQENABLE_MPU_2_OFFSET);
  }

 +/**
 + * Maximum time(us) it takes to output the signal WUCLKOUT of the last pad of
 + * the I/O ring after asserting WUCLKIN high
 + */
 +#define MAX_IOPAD_LATCH_TIME 1000
 +
Is the 1000 us/ms ?
Is that documented or arbitrary chosen ?

Rest of the change looks good to me.

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