From: Scott Wood <scottwood@freescale.com>
To: Anton Vorontsov <avorontsov@ru.mvista.com>
Cc: linux-usb@vger.kernel.org,
	Jerry Huang <Chang-Ming.Huang@freescale.com>,
	Greg Kroah-Hartman <gregkh@suse.de>,
	linuxppc-dev@ozlabs.org
Subject: Re: [PATCH 3/3] USB: ehci-fsl: Add power management support (resume after deep sleep)
Date: Thu, 24 Sep 2009 21:30:01 -0500	[thread overview]
Message-ID: <20090925023000.GA22457@b07421-ec1.am.freescale.net> (raw)
In-Reply-To: <20090923185244.GC18755@oksana.dev.rtsoft.ru>
On Wed, Sep 23, 2009 at 10:52:44PM +0400, Anton Vorontsov wrote:
+#ifdef CONFIG_SUSPEND
+struct ehci_fsl {
+       struct ehci_hcd ehci;
+
+       /* Saved USB PHY settings, need to restore after deep sleep. */
+       u32 usb_ctrl;
+};
This doesn't seem like the right place to define this... what if we later
need something else that isn't for suspend?  And you could get rid of
EHCI_FSL_PRIV_SIZE.
> +static int ehci_fsl_drv_suspend(struct device *dev)
> +{
> +	struct usb_hcd *hcd = dev_get_drvdata(dev);
> +	struct ehci_fsl *ehci_fsl = hcd_to_ehci_fsl(hcd);
> +	void __iomem *non_ehci = hcd->regs;
> +
> +	if (!fsl_deep_sleep())
> +		return 0;
We'll also need to do this if we support suspend to disk...  is there any
good way for the driver to determine that that's what's being done?  Or
more generally, for the platform to communicate to the drivers which ones
are going to lose state without one-off hacks like fsl_deep_sleep().
> +	/* Power up ports (avoids devices disconnect). */
> +	port_nm = HCS_N_PORTS(ehci->hcs_params);
> +	while (port_nm--) {
> +		u32 port_sc;
> +
> +		port_sc = ehci_readl(ehci, &ehci->regs->port_status[port_nm]);
> +		port_sc |= PORT_POWER;
> +		ehci_writel(ehci, port_sc, &ehci->regs->port_status[port_nm]);
> +	}
> +	mdelay(30);
Instead of mdelay, can we somehow hold off any USB operations for a
while?
-Scott
     prev parent reply	other threads:[~2009-09-25  2:30 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-23 18:51 [PATCH 0/3] USB: ehci-fsl: Resume from deep sleep Anton Vorontsov
2009-09-23 18:52 ` [PATCH 1/3] powerpc/fsl: Make fsl_deep_sleep() usable w/ modules and non-83xx builds Anton Vorontsov
2009-11-05 14:58   ` Kumar Gala
2009-09-23 18:52 ` [PATCH 2/3] USB: ehci-fsl: Fix sparse warnings Anton Vorontsov
2009-09-23 18:52 ` [PATCH 3/3] USB: ehci-fsl: Add power management support (resume after deep sleep) Anton Vorontsov
2009-09-25  2:30   ` Scott Wood [this message]
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=20090925023000.GA22457@b07421-ec1.am.freescale.net \
    --to=scottwood@freescale.com \
    --cc=Chang-Ming.Huang@freescale.com \
    --cc=avorontsov@ru.mvista.com \
    --cc=gregkh@suse.de \
    --cc=linux-usb@vger.kernel.org \
    --cc=linuxppc-dev@ozlabs.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).