linux-omap.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sebastian Andrzej Siewior <bigeasy-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org>
To: Daniel Mack <zonque-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	neumann-SRDuVqtxQLSzQB+pC5nmwQ@public.gmane.org,
	vinod.koul-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org,
	dan.j.williams-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org,
	balbi-l0cyMroinI0@public.gmane.org
Subject: [PATCH] usb: musb: dsps: disable the otg_timer while going to sleep
Date: Tue, 8 Oct 2013 12:44:16 +0200	[thread overview]
Message-ID: <20131008104416.GA5558@linutronix.de> (raw)
In-Reply-To: <1380643921-20642-1-git-send-email-zonque-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>

Testing with "freeze" I run into:

| PM: Syncing filesystems ... done.
| PM: Preparing system for freeze sleep
| Freezing user space processes ... (elapsed 0.002 seconds) done.
| Freezing remaining freezable tasks ... (elapsed 0.002 seconds) done.
| PM: Entering freeze sleep
| usb usb2: usb auto-resume
| hub 2-0:1.0: hub_resume
| hub 2-0:1.0: hub_suspend
| usb usb2: bus suspend, wakeup 0
| usb usb1: usb auto-resume
| hub 1-0:1.0: hub_resume
| hub 1-0:1.0: hub_suspend
| usb usb1: bus suspend, wakeup 0
| PM: suspend of devices complete after 54.622 msecs
| PM: late suspend of devices complete after 4.782 msecs
| PM: noirq suspend of devices complete after 4.990 msecs
| Unhandled fault: external abort on non-linefetch (0x1008) at 0xf0442460
| Internal error: : 1008 [#1] ARM
| PC is at otg_timer+0x28/0x140 [musb_dsps]

This is comming from first dsps_readb() in otg_timer(). The problem is
that the device is already suspended (the clocks are off) and the timer
tries to access register which fails.
Since there is no need to keep this timer aroud while the device is
going to suspend I suggest to remove the timer in suspend and queue it
in the resume path.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org>
---
I don't have the "suspend" target in "state" just the "freezer" and with
it I get into trouble in the otg_timer(). This triggers a few seconds
after the suspend but since this depends on timming, it might trigger
just a few secs after the suspend.
What about the this?

 drivers/usb/musb/musb_dsps.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c
index ced2b76..61b3f3e 100644
--- a/drivers/usb/musb/musb_dsps.c
+++ b/drivers/usb/musb/musb_dsps.c
@@ -659,6 +659,7 @@ static int dsps_suspend(struct device *dev)
 	glue->context.tx_mode = dsps_readl(mbase, wrp->tx_mode);
 	glue->context.rx_mode = dsps_readl(mbase, wrp->rx_mode);
 
+	del_timer_sync(&glue->timer);
 	return 0;
 }
 
@@ -679,6 +680,7 @@ static int dsps_resume(struct device *dev)
 
 	musb->port_reset_state = false;
 	schedule_work(&musb->port_reset_work);
+	mod_timer(&glue->timer, jiffies + wrp->poll_seconds * HZ);
 
 	return 0;
 }
-- 
1.8.4.rc3

--
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

      parent reply	other threads:[~2013-10-08 10:44 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-01 16:12 [PATCH v3] usb: musb: dsps: add support for suspend and resume Daniel Mack
     [not found] ` <1380643921-20642-1-git-send-email-zonque-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2013-10-08 10:44   ` Sebastian Andrzej Siewior [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=20131008104416.GA5558@linutronix.de \
    --to=bigeasy-hfztesqfncyowbw4kg4ksq@public.gmane.org \
    --cc=balbi-l0cyMroinI0@public.gmane.org \
    --cc=dan.j.williams-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    --cc=linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=neumann-SRDuVqtxQLSzQB+pC5nmwQ@public.gmane.org \
    --cc=vinod.koul-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    --cc=zonque-Re5JQEeQqe8AvxtiuMwx3w@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 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).