The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH] x86, olpc: Wait for last byte of EC command to be accepted
@ 2011-07-26 15:42 Daniel Drake
  2011-07-26 16:24 ` Andres Salomon
  2011-08-05 10:43 ` Ingo Molnar
  0 siblings, 2 replies; 4+ messages in thread
From: Daniel Drake @ 2011-07-26 15:42 UTC (permalink / raw)
  To: mingo, tglx, hpa, x86; +Cc: dilinger, pgf, linux-kernel

From: Paul Fox <pgf@laptop.org>

When executing EC commands, only waiting when there are still more bytes to
write is usually fine. However, if the system suspends very quickly after
a call to olpc_ec_cmd(), the last data byte may not yet be transferred to
the EC, and the command will not complete.

This solves a bug where the SCI wakeup mask was not correctly written
when going into suspend.

Signed-off-by: Paul Fox <pgf@laptop.org>
Signed-off-by: Daniel Drake <dsd@laptop.org>
---
 arch/x86/platform/olpc/olpc.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/platform/olpc/olpc.c b/arch/x86/platform/olpc/olpc.c
index 8b9940e..7cce722 100644
--- a/arch/x86/platform/olpc/olpc.c
+++ b/arch/x86/platform/olpc/olpc.c
@@ -161,13 +161,13 @@ restart:
 	if (inbuf && inlen) {
 		/* write data to EC */
 		for (i = 0; i < inlen; i++) {
+			pr_devel("olpc-ec:  sending cmd arg 0x%x\n", inbuf[i]);
+			outb(inbuf[i], 0x68);
 			if (wait_on_ibf(0x6c, 0)) {
 				printk(KERN_ERR "olpc-ec:  timeout waiting for"
 						" EC accept data!\n");
 				goto err;
 			}
-			pr_devel("olpc-ec:  sending cmd arg 0x%x\n", inbuf[i]);
-			outb(inbuf[i], 0x68);
 		}
 	}
 	if (outbuf && outlen) {
-- 
1.7.6


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

* Re: [PATCH] x86, olpc: Wait for last byte of EC command to be accepted
  2011-07-26 15:42 [PATCH] x86, olpc: Wait for last byte of EC command to be accepted Daniel Drake
@ 2011-07-26 16:24 ` Andres Salomon
  2011-08-05 10:43 ` Ingo Molnar
  1 sibling, 0 replies; 4+ messages in thread
From: Andres Salomon @ 2011-07-26 16:24 UTC (permalink / raw)
  To: Daniel Drake; +Cc: mingo, tglx, hpa, x86, pgf, linux-kernel

Acked-by: Andres Salomon <dilinger@queued.net>

After some squinting.. This patch looks correct.  This is a
long-standing issue, we should probably add a Cc: stable@kernel.org so
it gets picked up for stable kernels.

On Tue, 26 Jul 2011
16:42:26 +0100 (BST) Daniel Drake <dsd@laptop.org> wrote:

> From: Paul Fox <pgf@laptop.org>
> 
> When executing EC commands, only waiting when there are still more
> bytes to write is usually fine. However, if the system suspends very
> quickly after a call to olpc_ec_cmd(), the last data byte may not yet
> be transferred to the EC, and the command will not complete.
> 
> This solves a bug where the SCI wakeup mask was not correctly written
> when going into suspend.
> 
> Signed-off-by: Paul Fox <pgf@laptop.org>
> Signed-off-by: Daniel Drake <dsd@laptop.org>
> ---
>  arch/x86/platform/olpc/olpc.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/x86/platform/olpc/olpc.c
> b/arch/x86/platform/olpc/olpc.c index 8b9940e..7cce722 100644
> --- a/arch/x86/platform/olpc/olpc.c
> +++ b/arch/x86/platform/olpc/olpc.c
> @@ -161,13 +161,13 @@ restart:
>  	if (inbuf && inlen) {
>  		/* write data to EC */
>  		for (i = 0; i < inlen; i++) {
> +			pr_devel("olpc-ec:  sending cmd arg 0x%x\n",
> inbuf[i]);
> +			outb(inbuf[i], 0x68);
>  			if (wait_on_ibf(0x6c, 0)) {
>  				printk(KERN_ERR "olpc-ec:  timeout
> waiting for" " EC accept data!\n");
>  				goto err;
>  			}
> -			pr_devel("olpc-ec:  sending cmd arg 0x%x\n",
> inbuf[i]);
> -			outb(inbuf[i], 0x68);
>  		}
>  	}
>  	if (outbuf && outlen) {


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

* Re: [PATCH] x86, olpc: Wait for last byte of EC command to be accepted
  2011-07-26 15:42 [PATCH] x86, olpc: Wait for last byte of EC command to be accepted Daniel Drake
  2011-07-26 16:24 ` Andres Salomon
@ 2011-08-05 10:43 ` Ingo Molnar
  2011-08-05 10:55   ` Daniel Drake
  1 sibling, 1 reply; 4+ messages in thread
From: Ingo Molnar @ 2011-08-05 10:43 UTC (permalink / raw)
  To: Daniel Drake; +Cc: mingo, tglx, hpa, x86, dilinger, pgf, linux-kernel


* Daniel Drake <dsd@laptop.org> wrote:

> From: Paul Fox <pgf@laptop.org>
> 
> When executing EC commands, only waiting when there are still more bytes to
> write is usually fine. However, if the system suspends very quickly after
> a call to olpc_ec_cmd(), the last data byte may not yet be transferred to
> the EC, and the command will not complete.
> 
> This solves a bug where the SCI wakeup mask was not correctly written
> when going into suspend.

What did that result in - a resume hang? (i.e. how urgent is this fix 
- v3.1 material or v3.2 material?)

Thanks,

	Ingo

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

* Re: [PATCH] x86, olpc: Wait for last byte of EC command to be accepted
  2011-08-05 10:43 ` Ingo Molnar
@ 2011-08-05 10:55   ` Daniel Drake
  0 siblings, 0 replies; 4+ messages in thread
From: Daniel Drake @ 2011-08-05 10:55 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: mingo, tglx, hpa, x86, dilinger, pgf, linux-kernel

On Fri, Aug 5, 2011 at 11:43 AM, Ingo Molnar <mingo@elte.hu> wrote:
> What did that result in - a resume hang? (i.e. how urgent is this fix
> - v3.1 material or v3.2 material?)

Sorry - the explanation is indeed lacking in that area!

It means that sometimes, on XO-1.5 (but not XO-1), the devices that
were marked as wakeup sources can't wake up the system. e.g. you ask
for wifi wakeups, suspend, but then incoming wifi frames don't wake up
the system as they should.

In my opinion, as a simple bugfix (verified by 2 of our EC firmware
developers) it is 3.1 material.

Thanks,
Daniel

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

end of thread, other threads:[~2011-08-05 10:55 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-07-26 15:42 [PATCH] x86, olpc: Wait for last byte of EC command to be accepted Daniel Drake
2011-07-26 16:24 ` Andres Salomon
2011-08-05 10:43 ` Ingo Molnar
2011-08-05 10:55   ` Daniel Drake

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox