All of lore.kernel.org
 help / color / mirror / Atom feed
From: Roger Quadros <rogerq@ti.com>
To: Felipe Balbi <balbi@kernel.org>
Cc: vigneshr@ti.com, gregkh@linuxfoundation.org,
	linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
	"linux-stable # = v4 . 13" <stable@vger.kernel.org>,
	Heikki Krogerus <heikki.krogerus@linux.intel.com>
Subject: usb: dwc3: core: Don't try to get PHYs during suspend/resume
Date: Thu, 11 Jan 2018 11:23:17 +0200	[thread overview]
Message-ID: <d537e641-3ee5-4bda-e892-e0442207703c@ti.com> (raw)

On 11/01/18 11:09, Roger Quadros wrote:
> +Heikki
> 
> On 11/01/18 10:25, Felipe Balbi wrote:
>>
>> Hi,
>>
>> Roger Quadros <rogerq@ti.com> writes:
>>>>>> -	ret = dwc3_core_soft_reset(dwc);
>>>>>> +	ret = dwc3_core_get_phy(dwc);
>>>>>
>>>>> we can get_phy in dwc3_core_init() as it will get called on resume().
>>>>> This was the $subject of this patch.
>>>>
>>>> indeed. thanks :-)
>>>>
>>>
>>> oops sorry. I meant we can't call dwc3_core_get_phy() in dwc3_core_init(). :P
>>
>> bit of a chicken-and-egg problem. We need to setup the PHY interface
>> before getting the PHYs, but can't get PHY during resume. Maybe the best
>> way here would be to check for the pointers being valid. Something like:
>>
>> if (!phy)
>> 	get_phy();
>>
> 
> OK that should take care of not calling get_phy() on suspend.
> However there is one more issue with the approach
> 
>> @@ -754,15 +754,15 @@ static int dwc3_core_init(struct dwc3 *dwc)
>>  			dwc->maximum_speed = USB_SPEED_HIGH;
>>  	}
>>  
>> -	ret = dwc3_core_get_phy(dwc);
>> +	ret = dwc3_phy_setup(dwc);
>>  	if (ret)
>>  		goto err0;
> 
> here we configure PHY related bits and register the ulpi interface.
> 
>>  
>> -	ret = dwc3_core_soft_reset(dwc);
>> +	ret = dwc3_core_get_phy(dwc);
>>  	if (ret)
>>  		goto err0;
>>  
> 
> we got the PHYs. all OK here.
> 
>> -	ret = dwc3_phy_setup(dwc);
>> +	ret = dwc3_core_soft_reset(dwc);
>>  	if (ret)
>>  		goto err0;
> 
> Now we do a soft reset. This means we loose the PHY configuration bits that we did

Actually I was wrong. We're only resetting the device side (DCTL.CSFTRST) which doesn't seem to affect
GUSB2PHYCFGn and GUSB3PIPECTLn registers.

So we're good.

> in dwc3_phy_setup. So we need to call dwc3_phy_setup again but not re-register the ulpi interface.
> I can use a flag there so that dwc3_ulpi_init() is done only once.
>

WARNING: multiple messages have this Message-ID (diff)
From: Roger Quadros <rogerq@ti.com>
To: Felipe Balbi <balbi@kernel.org>
Cc: <vigneshr@ti.com>, <gregkh@linuxfoundation.org>,
	<linux-usb@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	"linux-stable # = v4 . 13" <stable@vger.kernel.org>,
	Heikki Krogerus <heikki.krogerus@linux.intel.com>
Subject: Re: [PATCH] usb: dwc3: core: Don't try to get PHYs during suspend/resume
Date: Thu, 11 Jan 2018 11:23:17 +0200	[thread overview]
Message-ID: <d537e641-3ee5-4bda-e892-e0442207703c@ti.com> (raw)
In-Reply-To: <a92149d9-58e8-ca11-485f-4040b080b133@ti.com>



On 11/01/18 11:09, Roger Quadros wrote:
> +Heikki
> 
> On 11/01/18 10:25, Felipe Balbi wrote:
>>
>> Hi,
>>
>> Roger Quadros <rogerq@ti.com> writes:
>>>>>> -	ret = dwc3_core_soft_reset(dwc);
>>>>>> +	ret = dwc3_core_get_phy(dwc);
>>>>>
>>>>> we can get_phy in dwc3_core_init() as it will get called on resume().
>>>>> This was the $subject of this patch.
>>>>
>>>> indeed. thanks :-)
>>>>
>>>
>>> oops sorry. I meant we can't call dwc3_core_get_phy() in dwc3_core_init(). :P
>>
>> bit of a chicken-and-egg problem. We need to setup the PHY interface
>> before getting the PHYs, but can't get PHY during resume. Maybe the best
>> way here would be to check for the pointers being valid. Something like:
>>
>> if (!phy)
>> 	get_phy();
>>
> 
> OK that should take care of not calling get_phy() on suspend.
> However there is one more issue with the approach
> 
>> @@ -754,15 +754,15 @@ static int dwc3_core_init(struct dwc3 *dwc)
>>  			dwc->maximum_speed = USB_SPEED_HIGH;
>>  	}
>>  
>> -	ret = dwc3_core_get_phy(dwc);
>> +	ret = dwc3_phy_setup(dwc);
>>  	if (ret)
>>  		goto err0;
> 
> here we configure PHY related bits and register the ulpi interface.
> 
>>  
>> -	ret = dwc3_core_soft_reset(dwc);
>> +	ret = dwc3_core_get_phy(dwc);
>>  	if (ret)
>>  		goto err0;
>>  
> 
> we got the PHYs. all OK here.
> 
>> -	ret = dwc3_phy_setup(dwc);
>> +	ret = dwc3_core_soft_reset(dwc);
>>  	if (ret)
>>  		goto err0;
> 
> Now we do a soft reset. This means we loose the PHY configuration bits that we did

Actually I was wrong. We're only resetting the device side (DCTL.CSFTRST) which doesn't seem to affect
GUSB2PHYCFGn and GUSB3PIPECTLn registers.

So we're good.

> in dwc3_phy_setup. So we need to call dwc3_phy_setup again but not re-register the ulpi interface.
> I can use a flag there so that dwc3_ulpi_init() is done only once.
> 

-- 
cheers,
-roger

Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

             reply	other threads:[~2018-01-11  9:23 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-11  9:23 Roger Quadros [this message]
2018-01-11  9:23 ` [PATCH] usb: dwc3: core: Don't try to get PHYs during suspend/resume Roger Quadros
  -- strict thread matches above, loose matches on Subject: below --
2018-01-11  9:46 Roger Quadros
2018-01-11  9:46 ` [PATCH] " Roger Quadros
2018-01-11  9:31 Felipe Balbi
2018-01-11  9:31 ` [PATCH] " Felipe Balbi
2018-01-11  9:09 Roger Quadros
2018-01-11  9:09 ` [PATCH] " Roger Quadros
2018-01-11  8:25 Felipe Balbi
2018-01-11  8:25 ` [PATCH] " Felipe Balbi
2018-01-10 14:13 Roger Quadros
2018-01-10 14:13 ` [PATCH] " Roger Quadros
2018-01-10 14:04 Felipe Balbi
2018-01-10 14:04 ` [PATCH] " Felipe Balbi
2018-01-10 13:56 Roger Quadros
2018-01-10 13:56 ` [PATCH] " Roger Quadros
2018-01-10 13:33 Felipe Balbi
2018-01-10 13:33 ` [PATCH] " Felipe Balbi
2018-01-10 13:24 Roger Quadros
2018-01-10 13:24 ` [PATCH] " Roger Quadros
2018-01-10 13:11 Roger Quadros
2018-01-10 13:11 ` [PATCH] " Roger Quadros

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=d537e641-3ee5-4bda-e892-e0442207703c@ti.com \
    --to=rogerq@ti.com \
    --cc=balbi@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=heikki.krogerus@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=vigneshr@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.