linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Johannes Berg <johannes@sipsolutions.net>
To: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Cc: linuxppc-dev@ozlabs.org, Paul Mackerras <paulus@samba.org>
Subject: Re: [PATCH] power-management elements for 603e/fsl (version 2)
Date: Mon, 21 May 2007 17:54:56 +0200	[thread overview]
Message-ID: <1179762897.9122.17.camel@johannes.berg> (raw)
In-Reply-To: <Pine.LNX.4.60.0705192013010.10162@poirot.grange>

[-- Attachment #1: Type: text/plain, Size: 1426 bytes --]

On Sat, 2007-05-19 at 21:22 +0200, Guennadi Liakhovetski wrote:

> +int fsl_suspend(suspend_state_t state)
> +{
> +	struct pci_dev *bridge;
> +	unsigned long flags;
> +	u16 pmcr1;
> +
> +	bridge = pci_find_slot(0, 0);
> +	if (!bridge)
> +		return -ENODEV;
> +
> +	pci_read_config_word(bridge, 0x70, &pmcr1);
> +	local_irq_save(flags);
> +	/* Apparently, MacOS uses NAP mode for Grackle ??? */

That comment seems out of place :)

> +	pmcr1 &= ~(MPC10X_DOZE | MPC10X_NAP);
> +	pmcr1 |= MPC10X_PM | MPC10X_SLEEP | MPC10X_LP_REF_EN;
> +	pci_write_config_word(bridge, 0x70, pmcr1);
> +	local_irq_restore(flags);
> +
> +	/* Make sure the decrementer won't interrupt us */
> +	asm volatile("mtdec %0" : : "r" (0x7fffffff));
> +	/* Make sure any pending DEC interrupt occurring while we did
> +	 * the above didn't re-enable the DEC */
> +	mb();
> +	asm volatile("mtdec %0" : : "r" (0x7fffffff)); /* 8 seconds */

Are you sure that's 8 seconds? Seems too fast.

Also, the whole irq handling thing in resume/suspend seems bogus. Both
resume and suspend are called with interrupts off, so the
local_irq_{save,restore} calls do nothing. You probably need to use
arch_suspend_{enable,disable}_irqs and do the decrementer magic there
(after all that's why we introduced these.)

Then again, see the other mail I'm about to send in response to a patch
from Scott Wood using these hooks.

johannes

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 190 bytes --]

  reply	other threads:[~2007-05-22  7:37 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-19 19:22 [PATCH] power-management elements for 603e/fsl (version 2) Guennadi Liakhovetski
2007-05-21 15:54 ` Johannes Berg [this message]
2007-05-21 15:57 ` Scott Wood
2007-05-21 20:50   ` Guennadi Liakhovetski
2007-07-01 21:19     ` Guennadi Liakhovetski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1179762897.9122.17.camel@johannes.berg \
    --to=johannes@sipsolutions.net \
    --cc=g.liakhovetski@gmx.de \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=paulus@samba.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).