From patchwork Sat Nov 3 01:41:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thinh Nguyen X-Patchwork-Id: 10666439 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BC32E17D4 for ; Sat, 3 Nov 2018 01:41:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 997052B79E for ; Sat, 3 Nov 2018 01:41:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 746F92B7B0; Sat, 3 Nov 2018 01:41:45 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E70252B79E for ; Sat, 3 Nov 2018 01:41:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728274AbeKCKvQ (ORCPT ); Sat, 3 Nov 2018 06:51:16 -0400 Received: from smtprelay.synopsys.com ([198.182.47.9]:37394 "EHLO smtprelay.synopsys.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728233AbeKCKvP (ORCPT ); Sat, 3 Nov 2018 06:51:15 -0400 Received: from mailhost.synopsys.com (mailhost2.synopsys.com [10.13.184.66]) by smtprelay.synopsys.com (Postfix) with ESMTP id DB18824E0876; Fri, 2 Nov 2018 18:41:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=synopsys.com; s=mail; t=1541209303; bh=BzQvxSICs+O9rHJKatQQiRoCWsfyG8sFFSubUiXPePs=; h=Date:From:Subject:To:CC:From; b=BGCBj8fmOlofxp5vZw5/K45ZOci4v2L0FQzLywrpZlmwrOl+LzYZZT90j3o7RHSZN vHBrkC7HZqYRtxRPKJSqRbTMtSrqAbLv6iZJxjjJXcVc4l6Rw17zg41nhdgXQKBS7S 4ueTRBy4PPW2JcDHcO+vITxwZikAxr+KEuCwUhxKZ7QLXaVfPMsrI/LJKGHtHoyA5b PPvQiTRZhO2tqHOJz874LmcXVwBDhbN9khlHT8GH4TL+5qEzhE4GYh+RAmrLHWsVqM X8FXA6yr2bmttd3nZx+lX28P+QZlUsMFSWcXm47mLaPRro0t5RgwEDM18Cqo9d5Mvy kYhDlC6W0MYkA== Received: from us01wehtc1.internal.synopsys.com (us01wehtc1-vip.internal.synopsys.com [10.12.239.236]) by mailhost.synopsys.com (Postfix) with ESMTP id CF8B13890; Fri, 2 Nov 2018 18:41:43 -0700 (PDT) Received: from US01WEHTC3.internal.synopsys.com (10.15.84.232) by us01wehtc1.internal.synopsys.com (10.12.239.231) with Microsoft SMTP Server (TLS) id 14.3.408.0; Fri, 2 Nov 2018 18:41:43 -0700 Received: from te-lab16 (10.13.184.20) by US01WEHTC3.internal.synopsys.com (10.15.84.231) with Microsoft SMTP Server (TLS) id 14.3.408.0; Fri, 2 Nov 2018 18:41:42 -0700 Received: by te-lab16 (sSMTP sendmail emulation); Fri, 02 Nov 2018 18:41:42 -0700 Date: Fri, 2 Nov 2018 18:41:42 -0700 Message-ID: <244a9f405cb3547aba69c03ff83fe45322e90c6d.1541209205.git.thinhn@synopsys.com> From: Thinh Nguyen Subject: [PATCH] usb: dwc3: Set default mode for DWC_usb3 v3.30a and higher To: Felipe Balbi , CC: John Youn MIME-Version: 1.0 X-Originating-IP: [10.13.184.20] Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP DWC_usb31 and DWC_usb3 v3.30a and higher do not support OTG mode. If the controller supports DRD but the dr_mode is not specified or set to OTG, then set the mode to peripheral. Signed-off-by: Thinh Nguyen --- drivers/usb/dwc3/core.c | 9 +++++---- drivers/usb/dwc3/core.h | 1 + 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index becfbb87f791..ef0c4f0f0b2a 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c @@ -80,11 +80,12 @@ static int dwc3_get_dr_mode(struct dwc3 *dwc) mode = USB_DR_MODE_PERIPHERAL; /* - * dwc_usb31 does not support OTG mode. If the controller - * supports DRD but the dr_mode is not specified or set to OTG, - * then set the mode to peripheral. + * DWC_usb31 and DWC_usb3 v3.30a and higher do not support OTG + * mode. If the controller supports DRD but the dr_mode is not + * specified or set to OTG, then set the mode to peripheral. */ - if (mode == USB_DR_MODE_OTG && dwc3_is_usb31(dwc)) + if (mode == USB_DR_MODE_OTG && + dwc->revision >= DWC3_REVISION_330A) mode = USB_DR_MODE_PERIPHERAL; } diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h index 5bfb62533e0f..d1e565da7f9a 100644 --- a/drivers/usb/dwc3/core.h +++ b/drivers/usb/dwc3/core.h @@ -1095,6 +1095,7 @@ struct dwc3 { #define DWC3_REVISION_290A 0x5533290a #define DWC3_REVISION_300A 0x5533300a #define DWC3_REVISION_310A 0x5533310a +#define DWC3_REVISION_330A 0x5533330a /* * NOTICE: we're using bit 31 as a "is usb 3.1" flag. This is really