From patchwork Fri Jul 18 11:39:34 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Baldyga X-Patchwork-Id: 33833 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pd0-f198.google.com (mail-pd0-f198.google.com [209.85.192.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id B5C7020CA0 for ; Fri, 18 Jul 2014 11:41:30 +0000 (UTC) Received: by mail-pd0-f198.google.com with SMTP id fp1sf24495198pdb.1 for ; Fri, 18 Jul 2014 04:41:30 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=1ZO8xchyqHONEkh0RoT1hwfMNubxCk73X1IersHQkkQ=; b=bnaIdELOGHir7OP7JD/rL48Z3sQ3+OfbLxdjgGG2yZZ8D9hOp5JenMT57SFZ2uRUIY JKD/P3jhLqt7yxa+Zjak7XGgOZGkFoZALTSibo8XjTLSlzu47zfCAKZJAyPDnG9Ingku +aT2tRfpN4O9LjWPlsKs5JmPL/jrZDcTrBRXn5FroaPxKqQqafJ2RySlmDWjgTxs5qO3 UFwxYKWzZuUAvWP1M5vHnkCgsxWKt6T9TqIisLcJZQ5cW5mPZpyEKrNgQyBZtpVMp1uK 1C2AHiSFdgJuPs4WYqJIz3RGd7VhKC/Qr8a0ydODjvgiMMY9+IL0Ddz9AD8WKBKeEtuS oLsQ== X-Gm-Message-State: ALoCoQkTgqvrzReUO+DlFeVB/2p1x/W2xCO7FsiWrAqImTdmdYSo75UhgHUcERTw10EUGtXupNhl X-Received: by 10.70.44.230 with SMTP id h6mr2137554pdm.7.1405683690044; Fri, 18 Jul 2014 04:41:30 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.89.203 with SMTP id v69ls928354qgd.6.gmail; Fri, 18 Jul 2014 04:41:29 -0700 (PDT) X-Received: by 10.52.17.129 with SMTP id o1mr4221020vdd.0.1405683689923; Fri, 18 Jul 2014 04:41:29 -0700 (PDT) Received: from mail-vc0-f174.google.com (mail-vc0-f174.google.com [209.85.220.174]) by mx.google.com with ESMTPS id ee6si5281588vdb.81.2014.07.18.04.41.29 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 18 Jul 2014 04:41:29 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.174 as permitted sender) client-ip=209.85.220.174; Received: by mail-vc0-f174.google.com with SMTP id la4so7001387vcb.5 for ; Fri, 18 Jul 2014 04:41:29 -0700 (PDT) X-Received: by 10.52.37.81 with SMTP id w17mr2256746vdj.95.1405683689839; Fri, 18 Jul 2014 04:41:29 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.221.37.5 with SMTP id tc5csp3208vcb; Fri, 18 Jul 2014 04:41:29 -0700 (PDT) X-Received: by 10.70.36.98 with SMTP id p2mr4353578pdj.14.1405683688644; Fri, 18 Jul 2014 04:41:28 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ct2si5653331pbc.92.2014.07.18.04.41.22; Fri, 18 Jul 2014 04:41:22 -0700 (PDT) Received-SPF: none (google.com: linux-kernel-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1761697AbaGRLkZ (ORCPT + 24 others); Fri, 18 Jul 2014 07:40:25 -0400 Received: from mailout3.samsung.com ([203.254.224.33]:25764 "EHLO mailout3.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1761672AbaGRLkU (ORCPT ); Fri, 18 Jul 2014 07:40:20 -0400 Received: from epcpsbgm2.samsung.com (epcpsbgm2 [203.254.230.27]) by mailout3.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0N8W00H2MOF7VSA0@mailout3.samsung.com>; Fri, 18 Jul 2014 20:40:19 +0900 (KST) X-AuditID: cbfee61b-f79f86d00000144c-50-53c907a34300 Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id 59.74.05196.3A709C35; Fri, 18 Jul 2014 20:40:19 +0900 (KST) Received: from AMDC2122.DIGITAL.local ([106.120.53.17]) by mmp1.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0N8W002CQOE11160@mmp1.samsung.com>; Fri, 18 Jul 2014 20:40:19 +0900 (KST) From: Robert Baldyga To: balbi@ti.com Cc: paulz@synopsys.com, gregkh@linuxfoundation.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, m.szyprowski@samsung.com, andrzej.p@samsung.com, Robert Baldyga Subject: [PATCH v3 09/12] usb: dwc2/gadget: delay enabling irq once hardware is configured properly Date: Fri, 18 Jul 2014 13:39:34 +0200 Message-id: <1405683577-11226-10-git-send-email-r.baldyga@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1405683577-11226-1-git-send-email-r.baldyga@samsung.com> References: <1405683577-11226-1-git-send-email-r.baldyga@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprBLMWRmVeSWpSXmKPExsVy+t9jAd3F7CeDDaa0S1jMetnOYnHwfr1F 8+L1bBaXd81hs1i0rJXZYu2Ru+wW26dMZ7J4cHgnuwOHx/65a9g9+rasYvTYsv8zo8fxG9uZ PD5vkgtgjeKySUnNySxLLdK3S+DKWLf2FUvBc56K4wfeMDUwXuDqYuTkkBAwkVh+7wIjhC0m ceHeerYuRi4OIYFFjBJ92w+wQjjtTBKH1txgAqliE9CR2PJ9AliHiICAxPoXl9hBipgFTjBK dPy/wAaSEBZIlbgzdyOYzSKgKnFs0RZWEJtXwE2i88B0Voh1chInj00GszmB4m2P/rN0MXIA bXOVmPaVfwIj7wJGhlWMoqkFyQXFSem5RnrFibnFpXnpesn5uZsYweH1THoH46oGi0OMAhyM Sjy8FjePBwuxJpYVV+YeYpTgYFYS4c2+DxTiTUmsrEotyo8vKs1JLT7EKM3BoiTOe7DVOlBI ID2xJDU7NbUgtQgmy8TBKdXAuPHhhCcFk91Nqpae6/zLwdyg7bP9+iSJ018yltrcWez+/MVk a/8EBuXd4Q3pgVInqhkkdrRncc2MF2y7vnnrg2fa+t83fWh8c2wKh0UpzzvGBTxrCvyuCT0y /7daw/Roi3LVk9vL1T3jJBdYXy572bl676R5SUmu09M/L+Nn+vez2sTstBebsBJLcUaioRZz UXEiAM+2eSMrAgAA Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: linux-kernel-owner@vger.kernel.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.174 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , From: Marek Szyprowski This patch fixes kernel panic/interrupt storm/etc issues if bootloader left s3c-hsotg module in enabled state. Now interrupt handler is enabled only after proper configuration of hardware registers. Signed-off-by: Marek Szyprowski Signed-off-by: Robert Baldyga --- drivers/usb/dwc2/gadget.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c index def4900..3435711 100644 --- a/drivers/usb/dwc2/gadget.c +++ b/drivers/usb/dwc2/gadget.c @@ -3459,13 +3459,6 @@ static int s3c_hsotg_probe(struct platform_device *pdev) hsotg->irq = ret; - ret = devm_request_irq(&pdev->dev, hsotg->irq, s3c_hsotg_irq, 0, - dev_name(dev), hsotg); - if (ret < 0) { - dev_err(dev, "cannot claim IRQ\n"); - goto err_clk; - } - dev_info(dev, "regs %p, irq %d\n", hsotg->regs, hsotg->irq); hsotg->gadget.max_speed = USB_SPEED_HIGH; @@ -3503,6 +3496,17 @@ static int s3c_hsotg_probe(struct platform_device *pdev) s3c_hsotg_hw_cfg(hsotg); s3c_hsotg_init(hsotg); + ret = devm_request_irq(&pdev->dev, hsotg->irq, s3c_hsotg_irq, 0, + dev_name(dev), hsotg); + if (ret < 0) { + s3c_hsotg_phy_disable(hsotg); + clk_disable_unprepare(hsotg->clk); + regulator_bulk_disable(ARRAY_SIZE(hsotg->supplies), + hsotg->supplies); + dev_err(dev, "cannot claim IRQ\n"); + goto err_clk; + } + /* hsotg->num_of_eps holds number of EPs other than ep0 */ if (hsotg->num_of_eps == 0) {