linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1] mfd: db8500-prcmu: update hostport_access enable
@ 2012-05-21  8:58 Arun Murthy
  2012-05-30  5:32 ` Arun MURTHY
  0 siblings, 1 reply; 5+ messages in thread
From: Arun Murthy @ 2012-05-21  8:58 UTC (permalink / raw)
  To: sameo, linux-kernel; +Cc: linus.walleij, arun.murthy

Force the Modem wakeup by asserting the CaWakeReq signal before the
hostaccess_req/ack ping-pong sequence. The Awake_req signal is de-asserted
asserted at the same time than the hostaccess_req. Return error on failure
case so that the client using this can take appropiate steps.

Signed-off-by: Arun Murthy <arun.murthy@stericsson.com>
Acked-by: Linus Walleij <linus.walleij@stericsson.com>
---
 drivers/mfd/db8500-prcmu.c       |   45 ++++++++++++++++----------------------
 drivers/mfd/dbx500-prcmu-regs.h  |    1 +
 include/linux/mfd/db8500-prcmu.h |    7 ++++-
 include/linux/mfd/dbx500-prcmu.h |    7 ++++-
 4 files changed, 30 insertions(+), 30 deletions(-)

diff --git a/drivers/mfd/db8500-prcmu.c b/drivers/mfd/db8500-prcmu.c
index 671c8bc..084d27c 100644
--- a/drivers/mfd/db8500-prcmu.c
+++ b/drivers/mfd/db8500-prcmu.c
@@ -2269,10 +2269,10 @@ int prcmu_abb_write(u8 slave, u8 reg, u8 *value, u8 size)
 /**
  * prcmu_ac_wake_req - should be called whenever ARM wants to wakeup Modem
  */
-void prcmu_ac_wake_req(void)
+int prcmu_ac_wake_req(void)
 {
 	u32 val;
-	u32 status;
+	int ret = 0;
 
 	mutex_lock(&mb0_transfer.ac_wake_lock);
 
@@ -2282,39 +2282,32 @@ void prcmu_ac_wake_req(void)
 
 	atomic_set(&ac_wake_req_state, 1);
 
-retry:
-	writel((val | PRCM_HOSTACCESS_REQ_HOSTACCESS_REQ), PRCM_HOSTACCESS_REQ);
+	/*
+	 * Force Modem Wake-up before hostaccess_req ping-pong.
+	 * It prevents Modem to enter in Sleep while acking the hostaccess
+	 * request. The 31us delay has been calculated by HWI.
+	 */
+	val |= PRCM_HOSTACCESS_REQ_WAKE_REQ;
+	writel(val, PRCM_HOSTACCESS_REQ);
+
+	udelay(31);
+
+	val |= PRCM_HOSTACCESS_REQ_HOSTACCESS_REQ;
+	writel(val, PRCM_HOSTACCESS_REQ);
 
 	if (!wait_for_completion_timeout(&mb0_transfer.ac_wake_work,
 			msecs_to_jiffies(5000))) {
+#if defined(CONFIG_DBX500_PRCMU_DEBUG)
+		db8500_prcmu_debug_dump(__func__, true, true);
+#endif
 		pr_crit("prcmu: %s timed out (5 s) waiting for a reply.\n",
 			__func__);
-		goto unlock_and_return;
-	}
-
-	/*
-	 * The modem can generate an AC_WAKE_ACK, and then still go to sleep.
-	 * As a workaround, we wait, and then check that the modem is indeed
-	 * awake (in terms of the value of the PRCM_MOD_AWAKE_STATUS
-	 * register, which may not be the whole truth).
-	 */
-	udelay(400);
-	status = (readl(PRCM_MOD_AWAKE_STATUS) & BITS(0, 2));
-	if (status != (PRCM_MOD_AWAKE_STATUS_PRCM_MOD_AAPD_AWAKE |
-			PRCM_MOD_AWAKE_STATUS_PRCM_MOD_COREPD_AWAKE)) {
-		pr_err("prcmu: %s received ack, but modem not awake (0x%X).\n",
-			__func__, status);
-		udelay(1200);
-		writel(val, PRCM_HOSTACCESS_REQ);
-		if (wait_for_completion_timeout(&mb0_transfer.ac_wake_work,
-				msecs_to_jiffies(5000)))
-			goto retry;
-		pr_crit("prcmu: %s timed out (5 s) waiting for AC_SLEEP_ACK.\n",
-			__func__);
+		ret = -EFAULT;
 	}
 
 unlock_and_return:
 	mutex_unlock(&mb0_transfer.ac_wake_lock);
+	return ret;
 }
 
 /**
diff --git a/drivers/mfd/dbx500-prcmu-regs.h b/drivers/mfd/dbx500-prcmu-regs.h
index 3a0bf91..23108a6 100644
--- a/drivers/mfd/dbx500-prcmu-regs.h
+++ b/drivers/mfd/dbx500-prcmu-regs.h
@@ -106,6 +106,7 @@
 
 #define PRCM_HOSTACCESS_REQ	(_PRCMU_BASE + 0x334)
 #define PRCM_HOSTACCESS_REQ_HOSTACCESS_REQ 0x1
+#define PRCM_HOSTACCESS_REQ_WAKE_REQ	BIT(16)
 #define ARM_WAKEUP_MODEM	0x1
 
 #define PRCM_ARM_IT1_CLR	(_PRCMU_BASE + 0x48C)
diff --git a/include/linux/mfd/db8500-prcmu.h b/include/linux/mfd/db8500-prcmu.h
index b3a43b1..b82f6ee 100644
--- a/include/linux/mfd/db8500-prcmu.h
+++ b/include/linux/mfd/db8500-prcmu.h
@@ -530,7 +530,7 @@ int db8500_prcmu_stop_temp_sense(void);
 int prcmu_abb_read(u8 slave, u8 reg, u8 *value, u8 size);
 int prcmu_abb_write(u8 slave, u8 reg, u8 *value, u8 size);
 
-void prcmu_ac_wake_req(void);
+int prcmu_ac_wake_req(void);
 void prcmu_ac_sleep_req(void);
 void db8500_prcmu_modem_reset(void);
 
@@ -680,7 +680,10 @@ static inline int prcmu_abb_write(u8 slave, u8 reg, u8 *value, u8 size)
 	return -ENOSYS;
 }
 
-static inline void prcmu_ac_wake_req(void) {}
+static inline int prcmu_ac_wake_req(void)
+{
+	return 0;
+}
 
 static inline void prcmu_ac_sleep_req(void) {}
 
diff --git a/include/linux/mfd/dbx500-prcmu.h b/include/linux/mfd/dbx500-prcmu.h
index 5a13f93..5b90e94 100644
--- a/include/linux/mfd/dbx500-prcmu.h
+++ b/include/linux/mfd/dbx500-prcmu.h
@@ -345,7 +345,7 @@ static inline u16 prcmu_get_reset_code(void)
 	return db8500_prcmu_get_reset_code();
 }
 
-void prcmu_ac_wake_req(void);
+int prcmu_ac_wake_req(void);
 void prcmu_ac_sleep_req(void);
 static inline void prcmu_modem_reset(void)
 {
@@ -533,7 +533,10 @@ static inline u16 prcmu_get_reset_code(void)
 	return 0;
 }
 
-static inline void prcmu_ac_wake_req(void) {}
+static inline int prcmu_ac_wake_req(void)
+{
+	return 0;
+}
 
 static inline void prcmu_ac_sleep_req(void) {}
 
-- 
1.7.4.3


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

* RE: [PATCH 1/1] mfd: db8500-prcmu: update hostport_access enable
  2012-05-21  8:58 [PATCH 1/1] mfd: db8500-prcmu: update hostport_access enable Arun Murthy
@ 2012-05-30  5:32 ` Arun MURTHY
  2012-05-31  1:58   ` Linus Walleij
  0 siblings, 1 reply; 5+ messages in thread
From: Arun MURTHY @ 2012-05-30  5:32 UTC (permalink / raw)
  To: Arun MURTHY, sameo, linux-kernel; +Cc: Linus WALLEIJ

> Force the Modem wakeup by asserting the CaWakeReq signal before the
> hostaccess_req/ack ping-pong sequence. The Awake_req signal is de-
> asserted
> asserted at the same time than the hostaccess_req. Return error on
> failure
> case so that the client using this can take appropiate steps.
> 
> Signed-off-by: Arun Murthy <arun.murthy@stericsson.com>
> Acked-by: Linus Walleij <linus.walleij@stericsson.com>
> ---


Any Comments?

Thanks and Regards,
Arun R Murthy
-------------

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

* Re: [PATCH 1/1] mfd: db8500-prcmu: update hostport_access enable
  2012-05-30  5:32 ` Arun MURTHY
@ 2012-05-31  1:58   ` Linus Walleij
  2012-06-04  6:21     ` Arun MURTHY
  0 siblings, 1 reply; 5+ messages in thread
From: Linus Walleij @ 2012-05-31  1:58 UTC (permalink / raw)
  To: Arun MURTHY; +Cc: sameo, linux-kernel, Linus WALLEIJ

On Wed, May 30, 2012 at 1:32 PM, Arun MURTHY <arun.murthy@stericsson.com> wrote:

>> Force the Modem wakeup by asserting the CaWakeReq signal before the
>> hostaccess_req/ack ping-pong sequence. The Awake_req signal is de-
>> asserted
>> asserted at the same time than the hostaccess_req. Return error on
>> failure
>> case so that the client using this can take appropiate steps.
>>
>> Signed-off-by: Arun Murthy <arun.murthy@stericsson.com>
>> Acked-by: Linus Walleij <linus.walleij@stericsson.com>
>> ---
>
>
> Any Comments?

Have you checked that this applies cleanly to the latest v3.5 HEAD from
Torvalds? I think I tried applying at one point and it didn't work.

Otherwise I think it's ripe for Sam to apply?

Yours,
Linus Walleij

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

* RE: [PATCH 1/1] mfd: db8500-prcmu: update hostport_access enable
  2012-05-31  1:58   ` Linus Walleij
@ 2012-06-04  6:21     ` Arun MURTHY
  2012-06-29 15:43       ` Samuel Ortiz
  0 siblings, 1 reply; 5+ messages in thread
From: Arun MURTHY @ 2012-06-04  6:21 UTC (permalink / raw)
  To: Linus Walleij; +Cc: sameo, linux-kernel, Linus WALLEIJ

> >> Force the Modem wakeup by asserting the CaWakeReq signal before the
> >> hostaccess_req/ack ping-pong sequence. The Awake_req signal is de-
> >> asserted
> >> asserted at the same time than the hostaccess_req. Return error on
> >> failure
> >> case so that the client using this can take appropiate steps.
> >>
> >> Signed-off-by: Arun Murthy <arun.murthy@stericsson.com>
> >> Acked-by: Linus Walleij <linus.walleij@stericsson.com>
> >> ---
> >
> >
> > Any Comments?
> 
> Have you checked that this applies cleanly to the latest v3.5 HEAD from
> Torvalds? I think I tried applying at one point and it didn't work.
> 
> Otherwise I think it's ripe for Sam to apply?
> 

The patch applies as is with no conflict.

Thanks and Regards,
Arun R Murthy
-------------

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

* Re: [PATCH 1/1] mfd: db8500-prcmu: update hostport_access enable
  2012-06-04  6:21     ` Arun MURTHY
@ 2012-06-29 15:43       ` Samuel Ortiz
  0 siblings, 0 replies; 5+ messages in thread
From: Samuel Ortiz @ 2012-06-29 15:43 UTC (permalink / raw)
  To: Arun MURTHY; +Cc: Linus Walleij, linux-kernel, Linus WALLEIJ

Hi Arun,

On Mon, Jun 04, 2012 at 08:21:25AM +0200, Arun MURTHY wrote:
> > >> Force the Modem wakeup by asserting the CaWakeReq signal before the
> > >> hostaccess_req/ack ping-pong sequence. The Awake_req signal is de-
> > >> asserted
> > >> asserted at the same time than the hostaccess_req. Return error on
> > >> failure
> > >> case so that the client using this can take appropiate steps.
> > >>
> > >> Signed-off-by: Arun Murthy <arun.murthy@stericsson.com>
> > >> Acked-by: Linus Walleij <linus.walleij@stericsson.com>
> > >> ---
> > >
> > >
> > > Any Comments?
> > 
> > Have you checked that this applies cleanly to the latest v3.5 HEAD from
> > Torvalds? I think I tried applying at one point and it didn't work.
> > 
> > Otherwise I think it's ripe for Sam to apply?
> > 
> 
> The patch applies as is with no conflict.
Patch applied, thanks.

Cheers,
Samuel.

-- 
Intel Open Source Technology Centre
http://oss.intel.com/

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

end of thread, other threads:[~2012-06-29 15:32 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-05-21  8:58 [PATCH 1/1] mfd: db8500-prcmu: update hostport_access enable Arun Murthy
2012-05-30  5:32 ` Arun MURTHY
2012-05-31  1:58   ` Linus Walleij
2012-06-04  6:21     ` Arun MURTHY
2012-06-29 15:43       ` Samuel Ortiz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).