From patchwork Tue Oct 8 10:44:16 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sebastian Andrzej Siewior X-Patchwork-Id: 3002821 Return-Path: X-Original-To: patchwork-linux-omap@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id AB3319F1E1 for ; Tue, 8 Oct 2013 10:44:25 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id AB87620176 for ; Tue, 8 Oct 2013 10:44:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4D61E200DC for ; Tue, 8 Oct 2013 10:44:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755809Ab3JHKoU (ORCPT ); Tue, 8 Oct 2013 06:44:20 -0400 Received: from www.linutronix.de ([62.245.132.108]:41393 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755430Ab3JHKoS (ORCPT ); Tue, 8 Oct 2013 06:44:18 -0400 Received: from bigeasy by Galois.linutronix.de with local (Exim 4.72) (envelope-from ) id 1VTUm0-0002Ug-Da; Tue, 08 Oct 2013 12:44:16 +0200 Date: Tue, 8 Oct 2013 12:44:16 +0200 From: Sebastian Andrzej Siewior To: Daniel Mack Cc: linux-usb@vger.kernel.org, linux-omap@vger.kernel.org, neumann@teufel.de, vinod.koul@intel.com, dan.j.williams@intel.com, balbi@ti.com Subject: [PATCH] usb: musb: dsps: disable the otg_timer while going to sleep Message-ID: <20131008104416.GA5558@linutronix.de> References: <1380643921-20642-1-git-send-email-zonque@gmail.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1380643921-20642-1-git-send-email-zonque@gmail.com> X-Key-Id: 97C4700B X-Key-Fingerprint: 09E2 D1F3 9A3A FF13 C3D3 961C 0688 1C1E 97C4 700B User-Agent: Mutt/1.5.20 (2009-06-14) Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Spam-Status: No, score=-7.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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; }