From patchwork Wed Jun 19 14:05:50 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roger Quadros X-Patchwork-Id: 2749791 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 3B42E9F8E1 for ; Wed, 19 Jun 2013 14:08:36 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7793120372 for ; Wed, 19 Jun 2013 14:08:31 +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 A20312036C for ; Wed, 19 Jun 2013 14:08:29 +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 1UpJ2X-00052t-Qy; Wed, 19 Jun 2013 14:07:14 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1UpJ2D-0004EJ-Nf; Wed, 19 Jun 2013 14:06:53 +0000 Received: from arroyo.ext.ti.com ([192.94.94.40]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UpJ1o-0004A3-08 for linux-arm-kernel@lists.infradead.org; Wed, 19 Jun 2013 14:06:29 +0000 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by arroyo.ext.ti.com (8.13.7/8.13.7) with ESMTP id r5JE65F6007036; Wed, 19 Jun 2013 09:06:05 -0500 Received: from DFLE72.ent.ti.com (dfle72.ent.ti.com [128.247.5.109]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id r5JE65ko021114; Wed, 19 Jun 2013 09:06:05 -0500 Received: from dlelxv22.itg.ti.com (172.17.1.197) by DFLE72.ent.ti.com (128.247.5.109) with Microsoft SMTP Server id 14.2.342.3; Wed, 19 Jun 2013 09:06:05 -0500 Received: from localhost.localdomain (h56-73.vpn.ti.com [172.24.56.73]) by dlelxv22.itg.ti.com (8.13.8/8.13.8) with ESMTP id r5JE5t2H021315; Wed, 19 Jun 2013 09:06:03 -0500 From: Roger Quadros To: , Subject: [RFC PATCH 3/6] USB: ehci: allow controller drivers to override irq & bus_suspend/resume Date: Wed, 19 Jun 2013 17:05:50 +0300 Message-ID: <1371650753-11452-4-git-send-email-rogerq@ti.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1371650753-11452-1-git-send-email-rogerq@ti.com> References: <1371650753-11452-1-git-send-email-rogerq@ti.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130619_100628_172239_FD44A6B4 X-CRM114-Status: GOOD ( 10.53 ) X-Spam-Score: -8.2 (--------) Cc: linux-usb@vger.kernel.org, ruslan.bilovol@ti.com, linux-kernel@vger.kernel.org, balbi@ti.com, linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Roger Quadros 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-5.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, 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 Some drivers (e.g. ehci_omap) need to do additional work in bus suspend/resume and interrupt handler to support low power modes and remote wakeup. Allow drivers to override these functions through ehci_driver_overrides. Also export the ehci_irq(), ehci_bus_suspend() and ehci_bus_resume() functions so they can be called from the controller drivers. CC: Alan Stern Signed-off-by: Roger Quadros --- drivers/usb/host/ehci-hcd.c | 9 ++++++++- drivers/usb/host/ehci-hub.c | 6 ++++-- drivers/usb/host/ehci.h | 6 ++++++ 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c index 246e124..8d35dd4 100644 --- a/drivers/usb/host/ehci-hcd.c +++ b/drivers/usb/host/ehci-hcd.c @@ -681,7 +681,7 @@ EXPORT_SYMBOL_GPL(ehci_setup); /*-------------------------------------------------------------------------*/ -static irqreturn_t ehci_irq (struct usb_hcd *hcd) +irqreturn_t ehci_irq(struct usb_hcd *hcd) { struct ehci_hcd *ehci = hcd_to_ehci (hcd); u32 status, masked_status, pcd_status = 0, cmd; @@ -828,6 +828,7 @@ dead: usb_hcd_poll_rh_status(hcd); return IRQ_HANDLED; } +EXPORT_SYMBOL_GPL(ehci_irq); /*-------------------------------------------------------------------------*/ @@ -1211,6 +1212,12 @@ void ehci_init_driver(struct hc_driver *drv, drv->hcd_priv_size += over->extra_priv_size; if (over->reset) drv->reset = over->reset; + if (over->bus_suspend) + drv->bus_suspend = over->bus_suspend; + if (over->bus_resume) + drv->bus_resume = over->bus_resume; + if (over->irq) + drv->irq = over->irq; } } EXPORT_SYMBOL_GPL(ehci_init_driver); diff --git a/drivers/usb/host/ehci-hub.c b/drivers/usb/host/ehci-hub.c index 9ab4a4d..1fc03f9 100644 --- a/drivers/usb/host/ehci-hub.c +++ b/drivers/usb/host/ehci-hub.c @@ -218,7 +218,7 @@ static void ehci_adjust_port_wakeup_flags(struct ehci_hcd *ehci, spin_unlock_irq(&ehci->lock); } -static int ehci_bus_suspend (struct usb_hcd *hcd) +int ehci_bus_suspend(struct usb_hcd *hcd) { struct ehci_hcd *ehci = hcd_to_ehci (hcd); int port; @@ -348,10 +348,11 @@ static int ehci_bus_suspend (struct usb_hcd *hcd) hrtimer_cancel(&ehci->hrtimer); return 0; } +EXPORT_SYMBOL_GPL(ehci_bus_suspend); /* caller has locked the root hub, and should reset/reinit on error */ -static int ehci_bus_resume (struct usb_hcd *hcd) +int ehci_bus_resume(struct usb_hcd *hcd) { struct ehci_hcd *ehci = hcd_to_ehci (hcd); u32 temp; @@ -489,6 +490,7 @@ static int ehci_bus_resume (struct usb_hcd *hcd) spin_unlock_irq(&ehci->lock); return -ESHUTDOWN; } +EXPORT_SYMBOL_GPL(ehci_bus_resume); #else diff --git a/drivers/usb/host/ehci.h b/drivers/usb/host/ehci.h index 7c978b2..992d626 100644 --- a/drivers/usb/host/ehci.h +++ b/drivers/usb/host/ehci.h @@ -795,15 +795,21 @@ static inline u32 hc32_to_cpup (const struct ehci_hcd *ehci, const __hc32 *x) struct ehci_driver_overrides { size_t extra_priv_size; int (*reset)(struct usb_hcd *hcd); + int (*bus_suspend)(struct usb_hcd *hcd); + int (*bus_resume)(struct usb_hcd *hcd); + irqreturn_t (*irq) (struct usb_hcd *hcd); }; extern void ehci_init_driver(struct hc_driver *drv, const struct ehci_driver_overrides *over); extern int ehci_setup(struct usb_hcd *hcd); +extern irqreturn_t ehci_irq(struct usb_hcd *hcd); #ifdef CONFIG_PM extern int ehci_suspend(struct usb_hcd *hcd, bool do_wakeup); extern int ehci_resume(struct usb_hcd *hcd, bool hibernated); +extern int ehci_bus_suspend(struct usb_hcd *hcd); +extern int ehci_bus_resume(struct usb_hcd *hcd); #endif /* CONFIG_PM */ #endif /* __LINUX_EHCI_HCD_H */