From: Felipe Balbi <felipe.balbi-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>
To: ext Ajay Kumar Gupta <ajay.gupta-l0cyMroinI0@public.gmane.org>
Cc: "linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
<linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
"linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
<linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
"Balbi Felipe (Nokia-D/Helsinki)"
<felipe.balbi-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>,
"david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org"
<david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org>,
Anand Gadiyar <gadiyar-l0cyMroinI0@public.gmane.org>
Subject: Re: [PATCH 2/3 v3] musb: Add context save and restore support
Date: Mon, 14 Dec 2009 18:33:24 +0200 [thread overview]
Message-ID: <20091214163324.GB31829@nokia.com> (raw)
In-Reply-To: <1260797982-28880-2-git-send-email-ajay.gupta-l0cyMroinI0@public.gmane.org>
Hi,
On Mon, Dec 14, 2009 at 02:39:41PM +0100, ext Ajay Kumar Gupta wrote:
>+void musb_restore_context(struct musb *musb)
>+{
>+ int i;
>+ void __iomem *musb_base = musb->mregs;
>+ void __iomem *ep_target_regs;
>+
>+ musb_platform_restore_context(&musb_context);
>+
>+ if (is_host_enabled(musb)) {
>+ musb_writew(musb_base, MUSB_FRAME, musb_context.frame);
>+ musb_writeb(musb_base, MUSB_TESTMODE, musb_context.testmode);
>+ }
>+ musb_writeb(musb_base, MUSB_POWER, musb_context.power);
>+ musb_writew(musb_base, MUSB_INTRTXE, musb_context.intrtxe);
>+ musb_writew(musb_base, MUSB_INTRRXE, musb_context.intrrxe);
>+ musb_writeb(musb_base, MUSB_INTRUSBE, musb_context.intrusbe);
>+ musb_writeb(musb_base, MUSB_DEVCTL, musb_context.devctl);
>+
>+ for (i = 0; i < MUSB_C_NUM_EPS; ++i) {
>+ musb_writeb(musb_base, MUSB_INDEX, i);
>+ musb_writew(musb_base, 0x10 + MUSB_TXMAXP,
>+ musb_context.index_regs[i].txmaxp);
>+ musb_writew(musb_base, 0x10 + MUSB_TXCSR,
>+ musb_context.index_regs[i].txcsr);
>+ musb_writew(musb_base, 0x10 + MUSB_RXMAXP,
>+ musb_context.index_regs[i].rxmaxp);
>+ musb_writew(musb_base, 0x10 + MUSB_RXCSR,
>+ musb_context.index_regs[i].rxcsr);
>+
>+ if (musb->dyn_fifo) {
if (musb->config->dyn_fifo)
>@@ -2179,15 +2322,23 @@ static int musb_suspend(struct device *dev)
> spin_lock_irqsave(&musb->lock, flags);
>
> if (is_peripheral_active(musb)) {
>- /* FIXME force disconnect unless we know USB will wake
>- * the system up quickly enough to respond ...
>+ /* System is entering into suspend where gadget would not be
>+ * able to respond to host and thus it will be in an unknown
>+ * state for host. Re-enumeration of gadget is required after
>+ * a resume. So we force a disconnect.
> */
>+ reg = musb_readb(musb->mregs, MUSB_POWER);
>+ reg &= ~MUSB_POWER_SOFTCONN;
>+ musb_writeb(musb->mregs, MUSB_POWER, reg);
>+
I think we should only allow suspend if cable isn't connected. What
would happend if you have mounted fs (using mass storage), user is
transferring files and you force a disconnect ?
>diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c
>index 83beeac..15a3f27 100644
>--- a/drivers/usb/musb/omap2430.c
>+++ b/drivers/usb/musb/omap2430.c
>@@ -255,6 +255,22 @@ int __init musb_platform_init(struct musb *musb)
> return 0;
> }
>
>+#ifdef CONFIG_PM
>+void musb_platform_save_context(struct musb_context_registers
>+ *musb_context)
>+{
>+ musb_context->otg_sysconfig = omap_readl(OTG_SYSCONFIG);
>+ musb_context->otg_forcestandby = omap_readl(OTG_FORCESTDBY);
>+}
>+
>+void musb_platform_restore_context(struct musb_context_registers
>+ *musb_context)
waaay too many exported functions already. Let's add some structure to
pass functions pointers. I'll cook a patch adding suspend(), resume(),
init() and friends and send tomorrow.
Then your patch would add save_context() and restore_context().
--
balbi
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2009-12-14 16:33 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-12-14 13:39 [PATCH 1/3] musb: save dynfifo in musb struct Ajay Kumar Gupta
[not found] ` <1260797982-28880-1-git-send-email-ajay.gupta-l0cyMroinI0@public.gmane.org>
2009-12-14 13:39 ` [PATCH 2/3 v3] musb: Add context save and restore support Ajay Kumar Gupta
2009-12-14 13:39 ` [PATCH 3/3] musb: Add 'extvbus' in musb_hdrc_platform_data Ajay Kumar Gupta
2009-12-14 16:37 ` Felipe Balbi
[not found] ` <20091214163746.GC31829-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>
2009-12-15 4:07 ` Gupta, Ajay Kumar
[not found] ` <1260797982-28880-2-git-send-email-ajay.gupta-l0cyMroinI0@public.gmane.org>
2009-12-14 16:33 ` Felipe Balbi [this message]
2009-12-14 16:39 ` [PATCH 2/3 v3] musb: Add context save and restore support Felipe Balbi
[not found] ` <20091214163324.GB31829-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>
2009-12-15 11:44 ` Gupta, Ajay Kumar
[not found] ` <19F8576C6E063C45BE387C64729E739404372AAF0F-/tLxBxkBPtCIQmiDNMet8wC/G2K4zDHf@public.gmane.org>
2009-12-15 12:04 ` Gadiyar, Anand
[not found] ` <5A47E75E594F054BAF48C5E4FC4B92AB030ADD53A6-/tLxBxkBPtCIQmiDNMet8wC/G2K4zDHf@public.gmane.org>
2009-12-15 12:10 ` Felipe Balbi
[not found] ` <20091215121032.GH3689-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>
2009-12-15 12:36 ` Gupta, Ajay Kumar
[not found] ` <19F8576C6E063C45BE387C64729E739404372AAF44-/tLxBxkBPtCIQmiDNMet8wC/G2K4zDHf@public.gmane.org>
2009-12-15 12:39 ` Gupta, Ajay Kumar
2009-12-15 12:48 ` Felipe Balbi
2009-12-17 13:38 ` Arnaud Mandy
2009-12-17 13:51 ` Gupta, Ajay Kumar
[not found] ` <19F8576C6E063C45BE387C64729E73940449F439C7-/tLxBxkBPtCIQmiDNMet8wC/G2K4zDHf@public.gmane.org>
2009-12-17 14:10 ` Arnaud Mandy
[not found] ` <4B2A3BEE.7000809-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>
2009-12-17 14:16 ` Gupta, Ajay Kumar
[not found] ` <19F8576C6E063C45BE387C64729E73940449F439D9-/tLxBxkBPtCIQmiDNMet8wC/G2K4zDHf@public.gmane.org>
2009-12-17 15:17 ` Arnaud Mandy
[not found] ` <4B2A4BA6.9010804-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>
2009-12-18 4:17 ` Gupta, Ajay Kumar
2009-12-14 16:24 ` [PATCH 1/3] musb: save dynfifo in musb struct Felipe Balbi
2009-12-15 4:04 ` Gupta, Ajay Kumar
[not found] ` <19F8576C6E063C45BE387C64729E739404372AAD03-/tLxBxkBPtCIQmiDNMet8wC/G2K4zDHf@public.gmane.org>
2009-12-15 7:26 ` Felipe Balbi
2009-12-15 7:37 ` Gupta, Ajay Kumar
[not found] ` <19F8576C6E063C45BE387C64729E739404372AAE01-/tLxBxkBPtCIQmiDNMet8wC/G2K4zDHf@public.gmane.org>
2009-12-15 7:40 ` Felipe Balbi
[not found] ` <20091215074025.GB3147-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>
2009-12-15 7:44 ` Gupta, Ajay Kumar
2009-12-15 8:32 ` Felipe Balbi
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=20091214163324.GB31829@nokia.com \
--to=felipe.balbi-xnzwkgviw5gavxtiumwx3w@public.gmane.org \
--cc=ajay.gupta-l0cyMroinI0@public.gmane.org \
--cc=david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org \
--cc=gadiyar-l0cyMroinI0@public.gmane.org \
--cc=linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.