From patchwork Wed Jul 8 10:36:35 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roger Quadros X-Patchwork-Id: 6744621 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.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 1FE8D9F2F0 for ; Wed, 8 Jul 2015 10:39:29 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 182F4205ED for ; Wed, 8 Jul 2015 10:39:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 27AEC205CB for ; Wed, 8 Jul 2015 10:39:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934394AbbGHKgo (ORCPT ); Wed, 8 Jul 2015 06:36:44 -0400 Received: from devils.ext.ti.com ([198.47.26.153]:49463 "EHLO devils.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932762AbbGHKgm (ORCPT ); Wed, 8 Jul 2015 06:36:42 -0400 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by devils.ext.ti.com (8.13.7/8.13.7) with ESMTP id t68Aaep3025556; Wed, 8 Jul 2015 05:36:40 -0500 Received: from DLEE71.ent.ti.com (dlee71.ent.ti.com [157.170.170.114]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id t68AaeCU010483; Wed, 8 Jul 2015 05:36:40 -0500 Received: from dflp33.itg.ti.com (10.64.6.16) by DLEE71.ent.ti.com (157.170.170.114) with Microsoft SMTP Server id 14.3.224.2; Wed, 8 Jul 2015 05:36:25 -0500 Received: from rockdesk.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp33.itg.ti.com (8.14.3/8.13.8) with ESMTP id t68AabG4008464; Wed, 8 Jul 2015 05:36:38 -0500 From: Roger Quadros To: CC: , , , , , Roger Quadros Subject: [PATCH v3 4/9] usb: dwc3: core: Adapt to named interrupts Date: Wed, 8 Jul 2015 13:36:35 +0300 Message-ID: <1436351795-28556-1-git-send-email-rogerq@ti.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1436351524-28385-1-git-send-email-rogerq@ti.com> References: <1436351524-28385-1-git-send-email-rogerq@ti.com> MIME-Version: 1.0 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.6 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 From: Felipe Balbi Add support to use interrupt names, Following are the interrupt names Peripheral Interrupt - peripheral HOST Interrupt - host OTG Interrupt - otg [Roger Q] - If any of these are missing we use the first available IRQ resource so that we don't break with older DTBs. - Use gadget_irq in gadget driver. Signed-off-by: Felipe Balbi Signed-off-by: Roger Quadros --- drivers/usb/dwc3/core.c | 12 ++++++++++++ drivers/usb/dwc3/core.h | 7 +++++++ drivers/usb/dwc3/gadget.c | 2 +- 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index a7498e0..7b33d7b 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c @@ -941,6 +941,18 @@ static int dwc3_probe(struct platform_device *pdev) dwc->xhci_resources[1].flags = res->flags; dwc->xhci_resources[1].name = res->name; + dwc->otg_irq = platform_get_irq_byname(pdev, "otg"); + if (!dwc->otg_irq) + dwc->otg_irq = res->start; + + dwc->gadget_irq = platform_get_irq_byname(pdev, "peripheral"); + if (!dwc->gadget_irq) + dwc->gadget_irq = res->start; + + dwc->xhci_irq = platform_get_irq_byname(pdev, "host"); + if (!dwc->xhci_irq) + dwc->xhci_irq = res->start; + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); if (!res) { dev_err(dev, "missing memory resource\n"); diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h index 9c1c094..c3431b2 100644 --- a/drivers/usb/dwc3/core.h +++ b/drivers/usb/dwc3/core.h @@ -742,6 +742,9 @@ struct dwc3_scratchpad_array { * @maximum_speed: maximum speed requested (mainly for testing purposes) * @revision: revision register contents * @dr_mode: requested mode of operation + * @xhci_irq: IRQ number for XHCI IRQs + * @gadget_irq: IRQ number for Peripheral IRQs + * @otg_irq: IRQ number for OTG IRQs * @usb2_phy: pointer to USB2 PHY * @usb3_phy: pointer to USB3 PHY * @usb2_generic_phy: pointer to USB2 PHY @@ -846,6 +849,10 @@ struct dwc3 { enum usb_dr_mode dr_mode; + int gadget_irq; + int xhci_irq; + int otg_irq; + /* used for suspend/resume */ u32 dcfg; u32 gctl; diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index 333a7c0..cf6b945 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -1531,7 +1531,7 @@ static int dwc3_gadget_start(struct usb_gadget *g, int irq; u32 reg; - irq = platform_get_irq(to_platform_device(dwc->dev), 0); + irq = dwc->gadget_irq; ret = request_threaded_irq(irq, dwc3_interrupt, dwc3_thread_interrupt, IRQF_SHARED, "dwc3", dwc); if (ret) {