From patchwork Mon Mar 30 00:09:59 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thinh Nguyen X-Patchwork-Id: 11464293 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3EB62913 for ; Mon, 30 Mar 2020 00:10:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1CA4F20784 for ; Mon, 30 Mar 2020 00:10:03 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=synopsys.com header.i=@synopsys.com header.b="dCWuFHjV" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727134AbgC3AKB (ORCPT ); Sun, 29 Mar 2020 20:10:01 -0400 Received: from smtprelay-out1.synopsys.com ([149.117.87.133]:46438 "EHLO smtprelay-out1.synopsys.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726403AbgC3AKB (ORCPT ); Sun, 29 Mar 2020 20:10:01 -0400 Received: from mailhost.synopsys.com (sv1-mailhost2.synopsys.com [10.205.2.132]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by smtprelay-out1.synopsys.com (Postfix) with ESMTPS id D3C8FC08E2; Mon, 30 Mar 2020 00:10:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=synopsys.com; s=mail; t=1585527000; bh=KZO16+o2QjRs4UxC4ORQLOQDWg5wibXQmGzn/dvBLY0=; h=Date:In-Reply-To:References:From:Subject:To:Cc:From; b=dCWuFHjVQJDy80yjyP9Vp9gGIwHAKQtcn0nDH7ZQAYR/+HAS8YulO/NzbibvQNkIY ysoUWudZIP2H8esiOpFMAKq6qKwfPxgTJ09mBTau4l2++fy7h4mc5n22FvA4FeCzj4 YJi2Z8JIHlP0H3qlHRwghbsZdmh+yBff/2J/uRU/rmAREKOai7eJaamO0F8oOvK6pW 69yOI86Z/ScC5hE8PaOZxxL8WxgwU5nY9Fz/Mp895vPfLMVO/EnHi/BV9q0bXuBYsm cF4TEgf77OnKcxOD8GLqaUseaKTqo908UNYlpBpIDT5a7HzCPXc/DAPCH7MijeneoN +Dm7q6Fa7ORRQ== Received: from te-lab16 (nanobot.internal.synopsys.com [10.10.186.99]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mailhost.synopsys.com (Postfix) with ESMTPSA id A3B72A006D; Mon, 30 Mar 2020 00:09:59 +0000 (UTC) Received: by te-lab16 (sSMTP sendmail emulation); Sun, 29 Mar 2020 17:09:59 -0700 Date: Sun, 29 Mar 2020 17:09:59 -0700 Message-Id: In-Reply-To: References: From: Thinh Nguyen Subject: [PATCH 1/2] usb: dwc3: drd: Don't free non-existing irq To: Felipe Balbi , Greg Kroah-Hartman , Thinh Nguyen , linux-usb@vger.kernel.org Cc: John Youn Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org If the driver is configured to use DRD role-switch, it's not OTG. There won't be OTG irq to free. Check for dwc->otg_irq before freeing it. Signed-off-by: Thinh Nguyen --- drivers/usb/dwc3/drd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/dwc3/drd.c b/drivers/usb/dwc3/drd.c index db68d48c2267..e6ec01972029 100644 --- a/drivers/usb/dwc3/drd.c +++ b/drivers/usb/dwc3/drd.c @@ -651,6 +651,6 @@ void dwc3_drd_exit(struct dwc3 *dwc) break; } - if (!dwc->edev) + if (dwc->otg_irq) free_irq(dwc->otg_irq, dwc); } From patchwork Mon Mar 30 00:10:05 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thinh Nguyen X-Patchwork-Id: 11464295 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A7D9B913 for ; Mon, 30 Mar 2020 00:10:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 827AE20787 for ; Mon, 30 Mar 2020 00:10:08 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=synopsys.com header.i=@synopsys.com header.b="BLuG83oZ" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727183AbgC3AKH (ORCPT ); Sun, 29 Mar 2020 20:10:07 -0400 Received: from smtprelay-out1.synopsys.com ([149.117.87.133]:46446 "EHLO smtprelay-out1.synopsys.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726403AbgC3AKH (ORCPT ); Sun, 29 Mar 2020 20:10:07 -0400 Received: from mailhost.synopsys.com (sv2-mailhost1.synopsys.com [10.205.2.133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by smtprelay-out1.synopsys.com (Postfix) with ESMTPS id F4127C08E2; Mon, 30 Mar 2020 00:10:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=synopsys.com; s=mail; t=1585527007; bh=To0bn0Fbz/hp7lX/UMgT2EPa1Uk/d3wQS6ReJrKzy0Y=; h=Date:In-Reply-To:References:From:Subject:To:Cc:From; b=BLuG83oZ/ixexq+k4JGFZ9AD5xArbdlfQNUuFh5+y6Bv1aPvSv0mLhStzN0PsnRZa KLJ0vGwACTwgL2jv8nauJU4cHf1bGEwvZRNO1xlhWMYU+9tI7EatpxCmrd2XB18knr BVc8Te3NWE2jIVB9Y2co4ve+vgIBba9RAF3Xqsk/N4yGXOyz4vlriGJmqRQsGNC4eC u82TWm/ekUzsmv60QO6pTNCPWceCN6UtDfeAt76f4slMJNKVdNbEKM+cwVxro5oYg1 DzhsIkyPt2UqOKPL406ke1gUrYEqISKaklF9dD4MQ3xb9YeL055Od7Tno7voMDMwqt 0zw344ZSr+8tg== Received: from te-lab16 (nanobot.internal.synopsys.com [10.10.186.99]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mailhost.synopsys.com (Postfix) with ESMTPSA id B7B79A00B1; Mon, 30 Mar 2020 00:10:05 +0000 (UTC) Received: by te-lab16 (sSMTP sendmail emulation); Sun, 29 Mar 2020 17:10:05 -0700 Date: Sun, 29 Mar 2020 17:10:05 -0700 Message-Id: <8c861d467863a87202df2df37cd84e590a665bdf.1585526614.git.thinhn@synopsys.com> In-Reply-To: References: From: Thinh Nguyen Subject: [PATCH 2/2] usb: dwc3: core: Use role-switch default dr_mode To: Felipe Balbi , Greg Kroah-Hartman , Thinh Nguyen , linux-usb@vger.kernel.org Cc: John Youn Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org If the driver is configured to use DRD role-switch, let the drd code path decide the default dr_mode. Signed-off-by: Thinh Nguyen --- drivers/usb/dwc3/core.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index 7046c681fece..ab6323b8e323 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c @@ -85,6 +85,8 @@ static int dwc3_get_dr_mode(struct dwc3 *dwc) * specified or set to OTG, then set the mode to peripheral. */ if (mode == USB_DR_MODE_OTG && + (!IS_ENABLED(CONFIG_USB_ROLE_SWITCH) || + !device_property_read_bool(dwc->dev, "usb-role-switch")) && dwc->revision >= DWC3_REVISION_330A) mode = USB_DR_MODE_PERIPHERAL; }