From patchwork Fri Oct 18 11:06:15 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Majunath Goudar X-Patchwork-Id: 3065671 Return-Path: X-Original-To: patchwork-linux-arm@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 C9EE79F243 for ; Fri, 18 Oct 2013 11:08:02 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9CDE6203DB for ; Fri, 18 Oct 2013 11:08:01 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5829F203B5 for ; Fri, 18 Oct 2013 11:08:00 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VX7u9-0003Lk-5P; Fri, 18 Oct 2013 11:07:41 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1VX7tz-0007Xy-Ew; Fri, 18 Oct 2013 11:07:31 +0000 Received: from mail-pb0-x235.google.com ([2607:f8b0:400e:c01::235]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VX7tl-0007VD-GP for linux-arm-kernel@lists.infradead.org; Fri, 18 Oct 2013 11:07:20 +0000 Received: by mail-pb0-f53.google.com with SMTP id up15so3650176pbc.40 for ; Fri, 18 Oct 2013 04:06:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=gcDm25nAlyoowQzG0G5kODq0dHx/kpwRM1Zr0w9QxXo=; b=zOT2AIT6q9YJa8BZGbZ0oPUb42vTxwZH5+2LzkITqqZmZ6+TFnmH1to/QPN4XTQHNG ttwnNHDm2X6suqy+Rkh4ONjNmTM1IrUeT9+B/BOm5Ztd9geqCvv7R+4asc9XZE1d24tS GS4e7JDUP/27ItrDMOu8IwPSJGW1k1GbijCQOJHCS9d/aS+GMrE1RwaC6OTL2NnDCD1F EiFTetQ55AMuAH0GA1BcKdRlIxQrWHjBhXkO1HbM03IBW0A3MtesuDR/+Ii5Fxh77f+Y GgcnKiN6h0/RTnSxoSImLiU1pmkT9KWpu6On7dhYtM+y+Fty0ZUVY/1WPe4rRk3B3ne0 JsYQ== X-Received: by 10.66.234.193 with SMTP id ug1mr3005595pac.92.1382094412669; Fri, 18 Oct 2013 04:06:52 -0700 (PDT) Received: from manjunath-Latitude-E6420.LGE.NET ([203.247.149.152]) by mx.google.com with ESMTPSA id ye1sm3543832pab.19.2013.10.18.04.06.47 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 18 Oct 2013 04:06:51 -0700 (PDT) From: Majunath Goudar To: csmanjuvijay@gmail.com Subject: [PATCH V3 5/6] USB: OHCI: Properly handle ohci-exynos suspend Date: Fri, 18 Oct 2013 16:36:15 +0530 Message-Id: <1382094376-31016-6-git-send-email-csmanjuvijay@gmail.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1382094376-31016-1-git-send-email-csmanjuvijay@gmail.com> References: <1380708947-15966-1-git-send-email-csmanjuvijay@gmail.com> <1382094376-31016-1-git-send-email-csmanjuvijay@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20131018_070717_806371_AAFE7A35 X-CRM114-Status: GOOD ( 16.39 ) X-Spam-Score: 0.1 (/) Cc: linux-samsung-soc@vger.kernel.org, Arnd Bergmann , Greg KH , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Kukjin Kim , linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-2.4 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,FREEMAIL_FROM,RCVD_IN_BL_SPAMCOP_NET,RCVD_IN_DNSWL_MED, RCVD_IN_SORBS_WEB,RP_MATCHES_RCVD,T_DKIM_INVALID,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 Suspend scenario in case of ohci-exynos glue was not properly handled as it was not suspending generic part of ohci controller. Alan Stern suggested, properly handle ohci-exynos suspend scenario. Calling explicitly the ohci_suspend() routine in exynos_ohci_suspend() will ensure proper handling of suspend scenario. Signed-off-by: Manjunath Goudar Acked-by: Alan Stern Cc: Arnd Bergmann Cc: Greg KH Cc: Kukjin Kim Cc: linux-arm-kernel@lists.infradead.org Cc: linux-samsung-soc@vger.kernel.org Cc: linux-kernel@vger.kernel.org Cc: linux-usb@vger.kernel.org --- V2->V3: -No changes. As a build failure on "ep93xx proper suspend patch" and Linaro id bounced. Rewrote this patch on top of latest Greg usb-next branch. This patch not gives any build error. Patch is required for ohci-exynos proper suspending as Alan mentioned. Initially when I wrote this patch I was working in Linaro, now I am not part of Linaro that is why Linaro id is bouncing. Sending this patch from personal mail id. V1->V2: -No changes. Due to the build failure on ep93xx reverted this patch. This patch is needed as Alan Stern suggestion. drivers/usb/host/ohci-exynos.c | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/drivers/usb/host/ohci-exynos.c b/drivers/usb/host/ohci-exynos.c index a87baed..4b5c8bd 100644 --- a/drivers/usb/host/ohci-exynos.c +++ b/drivers/usb/host/ohci-exynos.c @@ -192,23 +192,14 @@ static int exynos_ohci_suspend(struct device *dev) struct exynos_ohci_hcd *exynos_ohci = to_exynos_ohci(hcd); struct ohci_hcd *ohci = hcd_to_ohci(hcd); struct platform_device *pdev = to_platform_device(dev); + bool do_wakeup = device_may_wakeup(dev); unsigned long flags; - int rc = 0; + int rc = ohci_suspend(hcd, do_wakeup); - /* - * Root hub was already suspended. Disable irq emission and - * mark HW unaccessible, bail out if RH has been resumed. Use - * the spinlock to properly synchronize with possible pending - * RH suspend or resume activity. - */ - spin_lock_irqsave(&ohci->lock, flags); - if (ohci->rh_state != OHCI_RH_SUSPENDED && - ohci->rh_state != OHCI_RH_HALTED) { - rc = -EINVAL; - goto fail; - } + if (rc) + return rc; - clear_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags); + spin_lock_irqsave(&ohci->lock, flags); if (exynos_ohci->otg) exynos_ohci->otg->set_host(exynos_ohci->otg, &hcd->self); @@ -217,10 +208,9 @@ static int exynos_ohci_suspend(struct device *dev) clk_disable_unprepare(exynos_ohci->clk); -fail: spin_unlock_irqrestore(&ohci->lock, flags); - return rc; + return 0; } static int exynos_ohci_resume(struct device *dev)