From patchwork Mon Jan 22 13:11:25 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roger Quadros X-Patchwork-Id: 125422 Delivered-To: patch@linaro.org Received: by 10.46.66.141 with SMTP id h13csp1148690ljf; Mon, 22 Jan 2018 05:12:34 -0800 (PST) X-Google-Smtp-Source: AH8x224qlNmgfR/Ujq9G/EKDTxuo3ggxnovTwrhzg4JXEwmSWjH7rYN7O7VC8EIWcBXU5BGHRwGO X-Received: by 10.98.55.3 with SMTP id e3mr8564463pfa.119.1516626753994; Mon, 22 Jan 2018 05:12:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516626753; cv=none; d=google.com; s=arc-20160816; b=PXvdnSzE79rA4CQADvTPl+X42M+L0ARqbYkqiU0vscYidgdu1ysf+gyaB9rNGWcwzC oqPkdMzcw7+l/xEfNBv/8jAEG+j8PRqtH7Hi2AqA3+HzLrMPYurd0ODLXtCOrYsmHcjs wa2z+aSwzHDUlsAEHNO8/oUXmIjSyVTaehDLFjeEwYC/44mOrE37aPBEVX3trYkDJpXd WqDvqPjud0wlVK41r5QI2h0t//24sYpk9lJqyeo3NSY08JRHsKIRQnlTEPmYbWZDGU/3 GczGDdJQelqJWJTai3RNPwlZccSceX1Vit59c0KGHKhFCv7g5vUDeQ09r7q3vYPfAfFD 0Gyg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=E3GVU8iWHL7NtvsZIqYGd70m0yUMMeugfaJDIpk8/Vs=; b=SjJIpCqBlGZ2BzG9RiKVV9d5sL3JJFzd3ZPFufr93oN4X/nF+EVex7B4ETaPBQ5rAS MAduAnZK6Dx6d0IdoAqN+tuxsXNpnUwZVXZr0B3+ZYTy5kIbk3aXlfgO8ecZkYgE3E8D P2an7Zyo+lOReYirm9ljQULzxEHg1WAHe2jICguZfbsH5XTksA1bBSiRQnHcdxaOZE/K tPkOH+Tpqc8LNcKTm/2/XE96bey8oD2TsXh2ge2ZWtKPxVpOlq0UhdS2RaDTzoq5HlHn 4A+ED7+xuqGpb3hI3dzrYQmpBle3CrBfUG4Ajkd0VfZdAOuCuacugXHw3Z6DRT/54sLf hysQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@ti.com header.s=ti-com-17Q1 header.b=JUypxj5W; spf=pass (google.com: best guess record for domain of linux-usb-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-usb-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b5-v6si3487956pls.157.2018.01.22.05.12.33; Mon, 22 Jan 2018 05:12:33 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-usb-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@ti.com header.s=ti-com-17Q1 header.b=JUypxj5W; spf=pass (google.com: best guess record for domain of linux-usb-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-usb-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751314AbeAVNMb (ORCPT + 3 others); Mon, 22 Jan 2018 08:12:31 -0500 Received: from lelnx194.ext.ti.com ([198.47.27.80]:18677 "EHLO lelnx194.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751116AbeAVNLg (ORCPT ); Mon, 22 Jan 2018 08:11:36 -0500 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by lelnx194.ext.ti.com (8.15.1/8.15.1) with ESMTP id w0MDBZRZ006887; Mon, 22 Jan 2018 07:11:35 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1516626695; bh=Lyg3Laj4g+t6489+fk/qviqORcZXETHVxddctgMyqxY=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=JUypxj5WePLEESDRJ186eSSIGgJ03+1N27KscYLJ1zA54aM6oHEM1WZqbG3n/Uicc SvI5NBKZGloSc62zKxJT9lF8L1e1hgVlUulQsJw5aFfFFW3dXpPg1My5mnlqX79QX5 /T4NnhAn6lHne7VBb+2PAOZ0iKyBVB/m3keOZAU0= Received: from DLEE114.ent.ti.com (dlee114.ent.ti.com [157.170.170.25]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id w0MDBZw0030960; Mon, 22 Jan 2018 07:11:35 -0600 Received: from DLEE112.ent.ti.com (157.170.170.23) by DLEE114.ent.ti.com (157.170.170.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1261.35; Mon, 22 Jan 2018 07:11:34 -0600 Received: from dflp33.itg.ti.com (10.64.6.16) by DLEE112.ent.ti.com (157.170.170.23) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1261.35 via Frontend Transport; Mon, 22 Jan 2018 07:11:34 -0600 Received: from dlelxv97.itg.ti.com (dlelxv97.itg.ti.com [172.17.2.193]) by dflp33.itg.ti.com (8.14.3/8.13.8) with ESMTP id w0MDBYOT021776; Mon, 22 Jan 2018 07:11:34 -0600 Received: from lta0400828d.ti.com (vboxa0400828d.emea.dhcp.ti.com [172.22.235.94]) by dlelxv97.itg.ti.com (8.14.3/8.13.8) with ESMTP id w0MDBVwq029951; Mon, 22 Jan 2018 07:11:33 -0600 From: Roger Quadros To: CC: , , Roger Quadros Subject: [PATCH 1/4] usb: dwc3: prevent setting PRTCAP to OTG from debugfs Date: Mon, 22 Jan 2018 15:11:25 +0200 Message-ID: <1516626688-2302-2-git-send-email-rogerq@ti.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1516626688-2302-1-git-send-email-rogerq@ti.com> References: <1516626688-2302-1-git-send-email-rogerq@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org We don't support PRTCAP == OTG so prevent user from setting it via debugfs. Signed-off-by: Roger Quadros --- drivers/usb/dwc3/core.c | 3 +++ 1 file changed, 3 insertions(+) -- cheers, -roger Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index 85388dd..2929b1d 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c @@ -119,6 +119,9 @@ static void __dwc3_set_mode(struct work_struct *work) if (dwc->dr_mode != USB_DR_MODE_OTG) return; + if (dwc->desired_dr_role == DWC3_GCTL_PRTCAP_OTG) + return; + switch (dwc->current_dr_role) { case DWC3_GCTL_PRTCAP_HOST: dwc3_host_exit(dwc);