linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Felipe Balbi <balbi@kernel.org>
To: Roger Quadros <rogerq@ti.com>, Bin Liu <b-liu@ti.com>,
	linux-usb@vger.kernel.org
Subject: Re: [PATCH] usb: dwc3: turn off VBUS when leaving host mode
Date: Mon, 02 Dec 2019 09:41:42 +0200	[thread overview]
Message-ID: <87r21ncgy1.fsf@gmail.com> (raw)
In-Reply-To: <f12d3637-ad95-b5f5-f331-df791e85ab3a@ti.com>

[-- Attachment #1: Type: text/plain, Size: 1225 bytes --]


Hi,

Roger Quadros <rogerq@ti.com> writes:
> On 18/11/2019 09:07, Felipe Balbi wrote:
>> Hi,
>> 
>> Bin Liu <b-liu@ti.com> writes:
>> 
>>> 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")
>>> Signed-off-by: Bin Liu <b-liu@ti.com>
>>> ---
>>>   drivers/usb/dwc3/core.c | 1 +
>>>   1 file changed, 1 insertion(+)
>>>
>>> diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
>>> index 97d6ae3c4df2..76ac9cd54e64 100644
>>> --- a/drivers/usb/dwc3/core.c
>>> +++ b/drivers/usb/dwc3/core.c
>>> @@ -1201,6 +1201,7 @@ static void dwc3_core_exit_mode(struct dwc3 *dwc)
>>>   		break;
>>>   	case USB_DR_MODE_HOST:
>>>   		dwc3_host_exit(dwc);
>>> +		dwc3_set_prtcap(dwc, DWC3_GCTL_PRTCAP_DEVICE);
>> 
>> seems like this should be done as part of dwc3_host_exit()
>> 
>
> That wouldn't work well with OTG case as dwc3_host_exit(dwc) is
> called when switching roles and we don't want PRTCAP
> to change from DWC3_GCTL_PRTCAP_OTG.

if (port != OTG)
  set_prtcap(DEVICE)

-- 
balbi

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

  reply	other threads:[~2019-12-02  7:41 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-13 14:15 [PATCH] usb: dwc3: turn off VBUS when leaving host mode Bin Liu
2019-11-14  8:48 ` Roger Quadros
2019-11-14 14:16   ` Bin Liu
2019-11-18  7:07 ` Felipe Balbi
2019-11-18  9:51   ` Roger Quadros
2019-12-02  7:41     ` Felipe Balbi [this message]
2019-12-09 17:15       ` Bin Liu
2019-12-10 11:50         ` Felipe Balbi
2019-12-10 13:48           ` Bin Liu
2019-12-11 14:41             ` Felipe Balbi
2019-12-11 16:10               ` [PATCH v2] " Bin Liu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87r21ncgy1.fsf@gmail.com \
    --to=balbi@kernel.org \
    --cc=b-liu@ti.com \
    --cc=linux-usb@vger.kernel.org \
    --cc=rogerq@ti.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).