From patchwork Wed Nov 13 12:10:16 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Majunath Goudar X-Patchwork-Id: 3178001 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 BFEFE9F3A0 for ; Wed, 13 Nov 2013 12:12:01 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 87D7D20125 for ; Wed, 13 Nov 2013 12:12:00 +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 B47FF20111 for ; Wed, 13 Nov 2013 12:11:55 +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 1VgZI3-00056E-PL; Wed, 13 Nov 2013 12:11:24 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1VgZHv-0006O9-HA; Wed, 13 Nov 2013 12:11:15 +0000 Received: from mail-pd0-x22e.google.com ([2607:f8b0:400e:c02::22e]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VgZHi-0006ML-8O for linux-arm-kernel@lists.infradead.org; Wed, 13 Nov 2013 12:11:03 +0000 Received: by mail-pd0-f174.google.com with SMTP id y10so324946pdj.19 for ; Wed, 13 Nov 2013 04:10:40 -0800 (PST) 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=sK+mIhkNnOt1K9Obbr2DCF261COapIqGSVrwN5QMEws=; b=U3P7HW6FH6uZthGddyXbOAVldVZkpiB46HjwnegnRHc27Bv+H3SuUyJhN99tK2AI8+ Bih4ajzr5dg5XRUl5fQmsKeQUn/cBy4IeKp+xvDuz8pThhgTECpMV5Lhc6qSfN8QNyC8 4Aj5NBYKQoVDHqrjnucq8vRc5d3S8z7Q1MioH9nR7qr6MrR3tQxDKlELe6IByxrHrQWg d212dH/ySopoYHs7xNeFn3uFuREMbrt7a+K/IOJeb5Akbdyup1/dQvRxnsgp9y2NOwYu GjRUJx/FEyYasVxnp9r8fV9XHEpPkgf78JEX6T6sC0RS6VhA6USgiRsf9Zx4bm9toHw2 Totg== X-Received: by 10.66.152.102 with SMTP id ux6mr41062867pab.79.1384344640008; Wed, 13 Nov 2013 04:10:40 -0800 (PST) Received: from manjunath-Latitude-E6420.LGE.NET ([203.247.149.152]) by mx.google.com with ESMTPSA id qf7sm51287959pac.14.2013.11.13.04.10.35 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 13 Nov 2013 04:10:39 -0800 (PST) From: Majunath Goudar To: linux-arm-kernel@lists.infradead.org Subject: [PATCH V4 1/6] USB: OHCI: Properly handle OHCI controller suspend Date: Wed, 13 Nov 2013 17:40:16 +0530 Message-Id: <1384344621-6981-2-git-send-email-csmanjuvijay@gmail.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1384344621-6981-1-git-send-email-csmanjuvijay@gmail.com> References: <1380708947-15966-1-git-send-email-csmanjuvijay@gmail.com> <1384344621-6981-1-git-send-email-csmanjuvijay@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20131113_071102_470607_BF1F3B1B X-CRM114-Status: GOOD ( 13.59 ) X-Spam-Score: 0.1 (/) Cc: Greg KH , nataraja.km@lge.com, Majunath Goudar , linux-usb@vger.kernel.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.0 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=ham 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 was not properly handled in ochi_suspend()routine. Alan Stern suggested, properly handle OHCI suspend scenario. This does generic proper handling of suspend scenario to all OHCI SOC. Signed-off-by: Manjunath Goudar Acked-by: Alan Stern Cc: Greg KH Cc: linux-usb@vger.kernel.org --- V3->V4: - No changes, only added Alan Acked-by. V2->V3 : - No changes. As a build failure on ep93xx patch, reverted this patch(reveart commit id 476e4b). Rewrote this patch on top of latest Greg usb-next branch. This patch not gives any build error. patch is required for proper suspending as Alan mentioned. It is having common ohci suspend features w/o this following patches(still in usb-next) are not useful. Commit id "10abfa13"[PATCH 7/11] Properly handle ohci-omap suspend. Commit id "39dbd7df"[PATCH 8/11] Properly handle ohci-platform suspend. Commit id "4ceaa893"[PATCH 9/11] Properly handle ohci-pxa suspend. Commit id "f3c60599"[PATCH 10/11] Properly handle ohci-sm501 suspend. 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 change. Due to build failure on ep93xx reverted this patch. This patch is needed as Alan mentioned, it is having common ohci suspend features w/o this following patches(still in usb-next) are not useful. Commit id "10abfa13"[PATCH 7/11] Properly handle ohci-omap suspend. Commit id "39dbd7df"[PATCH 8/11] Properly handle ohci-platform suspend. Commit id "4ceaa893"[PATCH 9/11] Properly handle ohci-pxa suspend. Commit id "f3c60599"[PATCH 10/11] Properly handle ohci-sm501 suspend. drivers/usb/host/ohci-hcd.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c index 8ada13f..310bcfe 100644 --- a/drivers/usb/host/ohci-hcd.c +++ b/drivers/usb/host/ohci-hcd.c @@ -1036,6 +1036,7 @@ int ohci_suspend(struct usb_hcd *hcd, bool do_wakeup) { struct ohci_hcd *ohci = hcd_to_ohci (hcd); unsigned long flags; + int rc = 0; /* Disable irq emission and mark HW unaccessible. Use * the spinlock to properly synchronize with possible pending @@ -1048,7 +1049,13 @@ int ohci_suspend(struct usb_hcd *hcd, bool do_wakeup) clear_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags); spin_unlock_irqrestore (&ohci->lock, flags); - return 0; + synchronize_irq(hcd->irq); + + if (do_wakeup && HCD_WAKEUP_PENDING(hcd)) { + ohci_resume(hcd, false); + rc = -EBUSY; + } + return rc; } EXPORT_SYMBOL_GPL(ohci_suspend);