From patchwork Wed Dec 11 16:10:03 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Liu X-Patchwork-Id: 11285625 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 A0A75138C for ; Wed, 11 Dec 2019 16:10:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7E81A20836 for ; Wed, 11 Dec 2019 16:10:42 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="ZL+f33m2" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731156AbfLKQKl (ORCPT ); Wed, 11 Dec 2019 11:10:41 -0500 Received: from lelv0142.ext.ti.com ([198.47.23.249]:39814 "EHLO lelv0142.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731206AbfLKQKk (ORCPT ); Wed, 11 Dec 2019 11:10:40 -0500 Received: from lelv0265.itg.ti.com ([10.180.67.224]) by lelv0142.ext.ti.com (8.15.2/8.15.2) with ESMTP id xBBGAc5R080369; Wed, 11 Dec 2019 10:10:38 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1576080638; bh=a/ybdcnI6Ok1jxxFg1Wfn1E1tSZcHHuOUa0tzf5C/a4=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=ZL+f33m2Nj7E4SnJUyq4gIhjnnwBAK9hTAeGfegyf6UwmiUHzNFWroWV4NM7K1z4J KnnqqeWqPWnKoxIsZaboOH62e6HoKZ0FjFw+Uu1qTAa7ZRtYPteMj+BKYympxo7YjN teBG7rqlT6eB+UGKjRC4c9WMpsY/FYS1C1bMRf0M= Received: from DFLE113.ent.ti.com (dfle113.ent.ti.com [10.64.6.34]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id xBBGAcOE059096 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 11 Dec 2019 10:10:38 -0600 Received: from DFLE100.ent.ti.com (10.64.6.21) by DFLE113.ent.ti.com (10.64.6.34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1847.3; Wed, 11 Dec 2019 10:10:38 -0600 Received: from fllv0039.itg.ti.com (10.64.41.19) by DFLE100.ent.ti.com (10.64.6.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1847.3 via Frontend Transport; Wed, 11 Dec 2019 10:10:38 -0600 Received: from uda0271908.dal.design.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by fllv0039.itg.ti.com (8.15.2/8.15.2) with ESMTP id xBBGAcH6001814; Wed, 11 Dec 2019 10:10:38 -0600 From: Bin Liu To: CC: Felipe Balbi Subject: [PATCH v2] usb: dwc3: turn off VBUS when leaving host mode Date: Wed, 11 Dec 2019 10:10:03 -0600 Message-ID: <20191211161003.14950-1-b-liu@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <87blseyle9.fsf@kernel.org> References: <87blseyle9.fsf@kernel.org> 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 VBUS should be turned off when leaving the host mode. Set GCTL_PRTCAP to device mode in teardown to de-assert DRVVBUS pin to turn off VBUS power. Fixes: 5f94adfeed97 ("usb: dwc3: core: refactor mode initialization to its own function") Cc: stable@vger.kernel.org Signed-off-by: Bin Liu --- v2: cover dr_mode == OTG too. drivers/usb/dwc3/core.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index f561c6c9e8a9..1d85c42b9c67 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c @@ -1246,6 +1246,9 @@ static void dwc3_core_exit_mode(struct dwc3 *dwc) /* do nothing */ break; } + + /* de-assert DRVVBUS for HOST and OTG mode */ + dwc3_set_prtcap(dwc, DWC3_GCTL_PRTCAP_DEVICE); } static void dwc3_get_properties(struct dwc3 *dwc)