Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1364458 > unrolled thread

Re: [PATCH] usb: dwc2: do not override forced dr_mode in gadget setup

Started byJohn Youn <John.Youn@synopsys.com>
First post2016-03-24 22:30 +0100
Last post2016-03-31 00:50 +0200
Articles 4 — 3 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH] usb: dwc2: do not override forced dr_mode in gadget setup John Youn <John.Youn@synopsys.com> - 2016-03-24 22:30 +0100
    Re: [PATCH] usb: dwc2: do not override forced dr_mode in gadget setup Felipe Balbi <felipe.balbi@linux.intel.com> - 2016-03-30 12:20 +0200
      Re: [PATCH] usb: dwc2: do not override forced dr_mode in gadget setup Przemek Rudy <prudy1@o2.pl> - 2016-03-30 17:10 +0200
        Re: [PATCH] usb: dwc2: do not override forced dr_mode in gadget setup John Youn <John.Youn@synopsys.com> - 2016-03-31 00:50 +0200

#1364458 — Re: [PATCH] usb: dwc2: do not override forced dr_mode in gadget setup

FromJohn Youn <John.Youn@synopsys.com>
Date2016-03-24 22:30 +0100
SubjectRe: [PATCH] usb: dwc2: do not override forced dr_mode in gadget setup
Message-ID<rgkZk-8I-7@gated-at.bofh.it>
On 3/16/2016 3:10 PM, Przemek Rudy wrote:
> The host/device mode set with dr_mode should be kept all the time,
> not being changed to OTG in gadget setup (by overriding CFGUSB_FORCEDEVMODE
> and CFGUSB_FORCEHOSTMODE bits).
> 
> Signed-off-by: Przemek Rudy <prudy1@o2.pl>
> ---
>  drivers/usb/dwc2/gadget.c | 23 ++++++++++++++++++-----
>  1 file changed, 18 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c
> index e9940dd..818f158 100644
> --- a/drivers/usb/dwc2/gadget.c
> +++ b/drivers/usb/dwc2/gadget.c
> @@ -2254,6 +2254,7 @@ void dwc2_hsotg_core_init_disconnected(struct dwc2_hsotg *hsotg,
>  {
>  	u32 intmsk;
>  	u32 val;
> +	u32 usbcfg;
>  
>  	/* Kill any ep0 requests as controller will be reinitialized */
>  	kill_all_requests(hsotg, hsotg->eps_out[0], -ECONNRESET);
> @@ -2267,10 +2268,16 @@ void dwc2_hsotg_core_init_disconnected(struct dwc2_hsotg *hsotg,
>  	 * set configuration.
>  	 */
>  
> +	/* keep other bits untouched (so e.g. forced modes are not lost) */
> +	usbcfg = dwc2_readl(hsotg->regs + GUSBCFG);
> +	usbcfg &= ~(GUSBCFG_TOUTCAL_MASK | GUSBCFG_PHYIF16 | GUSBCFG_SRPCAP |
> +		GUSBCFG_HNPCAP);
> +
>  	/* set the PLL on, remove the HNP/SRP and set the PHY */
>  	val = (hsotg->phyif == GUSBCFG_PHYIF8) ? 9 : 5;
> -	dwc2_writel(hsotg->phyif | GUSBCFG_TOUTCAL(7) |
> -	       (val << GUSBCFG_USBTRDTIM_SHIFT), hsotg->regs + GUSBCFG);
> +	usbcfg |= hsotg->phyif | GUSBCFG_TOUTCAL(7) |
> +		(val << GUSBCFG_USBTRDTIM_SHIFT);
> +	dwc2_writel(usbcfg, hsotg->regs + GUSBCFG);
>  
>  	dwc2_hsotg_init_fifo(hsotg);
>  
> @@ -3031,6 +3038,7 @@ static struct usb_ep_ops dwc2_hsotg_ep_ops = {
>  static void dwc2_hsotg_init(struct dwc2_hsotg *hsotg)
>  {
>  	u32 trdtim;
> +	u32 usbcfg;
>  	/* unmask subset of endpoint interrupts */
>  
>  	dwc2_writel(DIEPMSK_TIMEOUTMSK | DIEPMSK_AHBERRMSK |
> @@ -3054,11 +3062,16 @@ static void dwc2_hsotg_init(struct dwc2_hsotg *hsotg)
>  
>  	dwc2_hsotg_init_fifo(hsotg);
>  
> +	/* keep other bits untouched (so e.g. forced modes are not lost) */
> +	usbcfg = dwc2_readl(hsotg->regs + GUSBCFG);
> +	usbcfg &= ~(GUSBCFG_TOUTCAL_MASK | GUSBCFG_PHYIF16 | GUSBCFG_SRPCAP |
> +		GUSBCFG_HNPCAP);
> +
>  	/* set the PLL on, remove the HNP/SRP and set the PHY */
>  	trdtim = (hsotg->phyif == GUSBCFG_PHYIF8) ? 9 : 5;
> -	dwc2_writel(hsotg->phyif | GUSBCFG_TOUTCAL(7) |
> -		(trdtim << GUSBCFG_USBTRDTIM_SHIFT),
> -		hsotg->regs + GUSBCFG);
> +	usbcfg |= hsotg->phyif | GUSBCFG_TOUTCAL(7) |
> +		(trdtim << GUSBCFG_USBTRDTIM_SHIFT);
> +	dwc2_writel(usbcfg, hsotg->regs + GUSBCFG);
>  
>  	if (using_dma(hsotg))
>  		__orr32(hsotg->regs + GAHBCFG, GAHBCFG_DMA_EN);
> 


Acked-by: John Youn <johnyoun@synopsys.com>
Tested-by: John Youn <johnyoun@synopsys.com>

Regards,
John
 

[toc] | [next] | [standalone]


#1367071

FromFelipe Balbi <felipe.balbi@linux.intel.com>
Date2016-03-30 12:20 +0200
Message-ID<rilod-3NH-9@gated-at.bofh.it>
In reply to#1364458

[Multipart message — attachments visible in raw view] — view raw

John Youn <John.Youn@synopsys.com> writes:
> [ text/plain ]
> On 3/16/2016 3:10 PM, Przemek Rudy wrote:
>> The host/device mode set with dr_mode should be kept all the time,
>> not being changed to OTG in gadget setup (by overriding CFGUSB_FORCEDEVMODE
>> and CFGUSB_FORCEHOSTMODE bits).
>> 
>> Signed-off-by: Przemek Rudy <prudy1@o2.pl>
>> ---
>>  drivers/usb/dwc2/gadget.c | 23 ++++++++++++++++++-----
>>  1 file changed, 18 insertions(+), 5 deletions(-)
>> 
>> diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c
>> index e9940dd..818f158 100644
>> --- a/drivers/usb/dwc2/gadget.c
>> +++ b/drivers/usb/dwc2/gadget.c
>> @@ -2254,6 +2254,7 @@ void dwc2_hsotg_core_init_disconnected(struct dwc2_hsotg *hsotg,
>>  {
>>  	u32 intmsk;
>>  	u32 val;
>> +	u32 usbcfg;
>>  
>>  	/* Kill any ep0 requests as controller will be reinitialized */
>>  	kill_all_requests(hsotg, hsotg->eps_out[0], -ECONNRESET);
>> @@ -2267,10 +2268,16 @@ void dwc2_hsotg_core_init_disconnected(struct dwc2_hsotg *hsotg,
>>  	 * set configuration.
>>  	 */
>>  
>> +	/* keep other bits untouched (so e.g. forced modes are not lost) */
>> +	usbcfg = dwc2_readl(hsotg->regs + GUSBCFG);
>> +	usbcfg &= ~(GUSBCFG_TOUTCAL_MASK | GUSBCFG_PHYIF16 | GUSBCFG_SRPCAP |
>> +		GUSBCFG_HNPCAP);
>> +
>>  	/* set the PLL on, remove the HNP/SRP and set the PHY */
>>  	val = (hsotg->phyif == GUSBCFG_PHYIF8) ? 9 : 5;
>> -	dwc2_writel(hsotg->phyif | GUSBCFG_TOUTCAL(7) |
>> -	       (val << GUSBCFG_USBTRDTIM_SHIFT), hsotg->regs + GUSBCFG);
>> +	usbcfg |= hsotg->phyif | GUSBCFG_TOUTCAL(7) |
>> +		(val << GUSBCFG_USBTRDTIM_SHIFT);
>> +	dwc2_writel(usbcfg, hsotg->regs + GUSBCFG);
>>  
>>  	dwc2_hsotg_init_fifo(hsotg);
>>  
>> @@ -3031,6 +3038,7 @@ static struct usb_ep_ops dwc2_hsotg_ep_ops = {
>>  static void dwc2_hsotg_init(struct dwc2_hsotg *hsotg)
>>  {
>>  	u32 trdtim;
>> +	u32 usbcfg;
>>  	/* unmask subset of endpoint interrupts */
>>  
>>  	dwc2_writel(DIEPMSK_TIMEOUTMSK | DIEPMSK_AHBERRMSK |
>> @@ -3054,11 +3062,16 @@ static void dwc2_hsotg_init(struct dwc2_hsotg *hsotg)
>>  
>>  	dwc2_hsotg_init_fifo(hsotg);
>>  
>> +	/* keep other bits untouched (so e.g. forced modes are not lost) */
>> +	usbcfg = dwc2_readl(hsotg->regs + GUSBCFG);
>> +	usbcfg &= ~(GUSBCFG_TOUTCAL_MASK | GUSBCFG_PHYIF16 | GUSBCFG_SRPCAP |
>> +		GUSBCFG_HNPCAP);
>> +
>>  	/* set the PLL on, remove the HNP/SRP and set the PHY */
>>  	trdtim = (hsotg->phyif == GUSBCFG_PHYIF8) ? 9 : 5;
>> -	dwc2_writel(hsotg->phyif | GUSBCFG_TOUTCAL(7) |
>> -		(trdtim << GUSBCFG_USBTRDTIM_SHIFT),
>> -		hsotg->regs + GUSBCFG);
>> +	usbcfg |= hsotg->phyif | GUSBCFG_TOUTCAL(7) |
>> +		(trdtim << GUSBCFG_USBTRDTIM_SHIFT);
>> +	dwc2_writel(usbcfg, hsotg->regs + GUSBCFG);
>>  
>>  	if (using_dma(hsotg))
>>  		__orr32(hsotg->regs + GAHBCFG, GAHBCFG_DMA_EN);
>> 
>
>
> Acked-by: John Youn <johnyoun@synopsys.com>
> Tested-by: John Youn <johnyoun@synopsys.com>

I suppose this is for v4.7 merge window ?

-- 
balbi

[toc] | [prev] | [next] | [standalone]


#1367274

FromPrzemek Rudy <prudy1@o2.pl>
Date2016-03-30 17:10 +0200
Message-ID<ripUT-7fj-25@gated-at.bofh.it>
In reply to#1367071
On 03/30/2016 12:15 PM, Felipe Balbi wrote:
> John Youn <John.Youn@synopsys.com> writes:
>> [ text/plain ]
>> On 3/16/2016 3:10 PM, Przemek Rudy wrote:
>>> The host/device mode set with dr_mode should be kept all the time,
>>> not being changed to OTG in gadget setup (by overriding CFGUSB_FORCEDEVMODE
>>> and CFGUSB_FORCEHOSTMODE bits).
>>>
>>> Signed-off-by: Przemek Rudy <prudy1@o2.pl>
>>> ---
>>>  drivers/usb/dwc2/gadget.c | 23 ++++++++++++++++++-----
>>>  1 file changed, 18 insertions(+), 5 deletions(-)
>>>
>>> diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c
>>> index e9940dd..818f158 100644
>>> --- a/drivers/usb/dwc2/gadget.c
>>> +++ b/drivers/usb/dwc2/gadget.c
>>> @@ -2254,6 +2254,7 @@ void dwc2_hsotg_core_init_disconnected(struct dwc2_hsotg *hsotg,
>>>  {
>>>  	u32 intmsk;
>>>  	u32 val;
>>> +	u32 usbcfg;
>>>  
>>>  	/* Kill any ep0 requests as controller will be reinitialized */
>>>  	kill_all_requests(hsotg, hsotg->eps_out[0], -ECONNRESET);
>>> @@ -2267,10 +2268,16 @@ void dwc2_hsotg_core_init_disconnected(struct dwc2_hsotg *hsotg,
>>>  	 * set configuration.
>>>  	 */
>>>  
>>> +	/* keep other bits untouched (so e.g. forced modes are not lost) */
>>> +	usbcfg = dwc2_readl(hsotg->regs + GUSBCFG);
>>> +	usbcfg &= ~(GUSBCFG_TOUTCAL_MASK | GUSBCFG_PHYIF16 | GUSBCFG_SRPCAP |
>>> +		GUSBCFG_HNPCAP);
>>> +
>>>  	/* set the PLL on, remove the HNP/SRP and set the PHY */
>>>  	val = (hsotg->phyif == GUSBCFG_PHYIF8) ? 9 : 5;
>>> -	dwc2_writel(hsotg->phyif | GUSBCFG_TOUTCAL(7) |
>>> -	       (val << GUSBCFG_USBTRDTIM_SHIFT), hsotg->regs + GUSBCFG);
>>> +	usbcfg |= hsotg->phyif | GUSBCFG_TOUTCAL(7) |
>>> +		(val << GUSBCFG_USBTRDTIM_SHIFT);
>>> +	dwc2_writel(usbcfg, hsotg->regs + GUSBCFG);
>>>  
>>>  	dwc2_hsotg_init_fifo(hsotg);
>>>  
>>> @@ -3031,6 +3038,7 @@ static struct usb_ep_ops dwc2_hsotg_ep_ops = {
>>>  static void dwc2_hsotg_init(struct dwc2_hsotg *hsotg)
>>>  {
>>>  	u32 trdtim;
>>> +	u32 usbcfg;
>>>  	/* unmask subset of endpoint interrupts */
>>>  
>>>  	dwc2_writel(DIEPMSK_TIMEOUTMSK | DIEPMSK_AHBERRMSK |
>>> @@ -3054,11 +3062,16 @@ static void dwc2_hsotg_init(struct dwc2_hsotg *hsotg)
>>>  
>>>  	dwc2_hsotg_init_fifo(hsotg);
>>>  
>>> +	/* keep other bits untouched (so e.g. forced modes are not lost) */
>>> +	usbcfg = dwc2_readl(hsotg->regs + GUSBCFG);
>>> +	usbcfg &= ~(GUSBCFG_TOUTCAL_MASK | GUSBCFG_PHYIF16 | GUSBCFG_SRPCAP |
>>> +		GUSBCFG_HNPCAP);
>>> +
>>>  	/* set the PLL on, remove the HNP/SRP and set the PHY */
>>>  	trdtim = (hsotg->phyif == GUSBCFG_PHYIF8) ? 9 : 5;
>>> -	dwc2_writel(hsotg->phyif | GUSBCFG_TOUTCAL(7) |
>>> -		(trdtim << GUSBCFG_USBTRDTIM_SHIFT),
>>> -		hsotg->regs + GUSBCFG);
>>> +	usbcfg |= hsotg->phyif | GUSBCFG_TOUTCAL(7) |
>>> +		(trdtim << GUSBCFG_USBTRDTIM_SHIFT);
>>> +	dwc2_writel(usbcfg, hsotg->regs + GUSBCFG);
>>>  
>>>  	if (using_dma(hsotg))
>>>  		__orr32(hsotg->regs + GAHBCFG, GAHBCFG_DMA_EN);
>>>
>>
>>
>> Acked-by: John Youn <johnyoun@synopsys.com>
>> Tested-by: John Youn <johnyoun@synopsys.com>
> 
> I suppose this is for v4.7 merge window ?
> 
Technically - patch was started against 4.5, as there are no conflict changes around the file it fits for 4.6, 4.7.

[toc] | [prev] | [next] | [standalone]


#1367656

FromJohn Youn <John.Youn@synopsys.com>
Date2016-03-31 00:50 +0200
Message-ID<rix62-3Fi-7@gated-at.bofh.it>
In reply to#1367274
On 3/30/2016 8:08 AM, Przemek Rudy wrote:
> On 03/30/2016 12:15 PM, Felipe Balbi wrote:
>> John Youn <John.Youn@synopsys.com> writes:
>>> [ text/plain ]
>>> On 3/16/2016 3:10 PM, Przemek Rudy wrote:
>>>> The host/device mode set with dr_mode should be kept all the time,
>>>> not being changed to OTG in gadget setup (by overriding CFGUSB_FORCEDEVMODE
>>>> and CFGUSB_FORCEHOSTMODE bits).
>>>>
>>>> Signed-off-by: Przemek Rudy <prudy1@o2.pl>
>>>> ---
>>>>  drivers/usb/dwc2/gadget.c | 23 ++++++++++++++++++-----
>>>>  1 file changed, 18 insertions(+), 5 deletions(-)
>>>>
>>>> diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c
>>>> index e9940dd..818f158 100644
>>>> --- a/drivers/usb/dwc2/gadget.c
>>>> +++ b/drivers/usb/dwc2/gadget.c
>>>> @@ -2254,6 +2254,7 @@ void dwc2_hsotg_core_init_disconnected(struct dwc2_hsotg *hsotg,
>>>>  {
>>>>  	u32 intmsk;
>>>>  	u32 val;
>>>> +	u32 usbcfg;
>>>>  
>>>>  	/* Kill any ep0 requests as controller will be reinitialized */
>>>>  	kill_all_requests(hsotg, hsotg->eps_out[0], -ECONNRESET);
>>>> @@ -2267,10 +2268,16 @@ void dwc2_hsotg_core_init_disconnected(struct dwc2_hsotg *hsotg,
>>>>  	 * set configuration.
>>>>  	 */
>>>>  
>>>> +	/* keep other bits untouched (so e.g. forced modes are not lost) */
>>>> +	usbcfg = dwc2_readl(hsotg->regs + GUSBCFG);
>>>> +	usbcfg &= ~(GUSBCFG_TOUTCAL_MASK | GUSBCFG_PHYIF16 | GUSBCFG_SRPCAP |
>>>> +		GUSBCFG_HNPCAP);
>>>> +
>>>>  	/* set the PLL on, remove the HNP/SRP and set the PHY */
>>>>  	val = (hsotg->phyif == GUSBCFG_PHYIF8) ? 9 : 5;
>>>> -	dwc2_writel(hsotg->phyif | GUSBCFG_TOUTCAL(7) |
>>>> -	       (val << GUSBCFG_USBTRDTIM_SHIFT), hsotg->regs + GUSBCFG);
>>>> +	usbcfg |= hsotg->phyif | GUSBCFG_TOUTCAL(7) |
>>>> +		(val << GUSBCFG_USBTRDTIM_SHIFT);
>>>> +	dwc2_writel(usbcfg, hsotg->regs + GUSBCFG);
>>>>  
>>>>  	dwc2_hsotg_init_fifo(hsotg);
>>>>  
>>>> @@ -3031,6 +3038,7 @@ static struct usb_ep_ops dwc2_hsotg_ep_ops = {
>>>>  static void dwc2_hsotg_init(struct dwc2_hsotg *hsotg)
>>>>  {
>>>>  	u32 trdtim;
>>>> +	u32 usbcfg;
>>>>  	/* unmask subset of endpoint interrupts */
>>>>  
>>>>  	dwc2_writel(DIEPMSK_TIMEOUTMSK | DIEPMSK_AHBERRMSK |
>>>> @@ -3054,11 +3062,16 @@ static void dwc2_hsotg_init(struct dwc2_hsotg *hsotg)
>>>>  
>>>>  	dwc2_hsotg_init_fifo(hsotg);
>>>>  
>>>> +	/* keep other bits untouched (so e.g. forced modes are not lost) */
>>>> +	usbcfg = dwc2_readl(hsotg->regs + GUSBCFG);
>>>> +	usbcfg &= ~(GUSBCFG_TOUTCAL_MASK | GUSBCFG_PHYIF16 | GUSBCFG_SRPCAP |
>>>> +		GUSBCFG_HNPCAP);
>>>> +
>>>>  	/* set the PLL on, remove the HNP/SRP and set the PHY */
>>>>  	trdtim = (hsotg->phyif == GUSBCFG_PHYIF8) ? 9 : 5;
>>>> -	dwc2_writel(hsotg->phyif | GUSBCFG_TOUTCAL(7) |
>>>> -		(trdtim << GUSBCFG_USBTRDTIM_SHIFT),
>>>> -		hsotg->regs + GUSBCFG);
>>>> +	usbcfg |= hsotg->phyif | GUSBCFG_TOUTCAL(7) |
>>>> +		(trdtim << GUSBCFG_USBTRDTIM_SHIFT);
>>>> +	dwc2_writel(usbcfg, hsotg->regs + GUSBCFG);
>>>>  
>>>>  	if (using_dma(hsotg))
>>>>  		__orr32(hsotg->regs + GAHBCFG, GAHBCFG_DMA_EN);
>>>>
>>>
>>>
>>> Acked-by: John Youn <johnyoun@synopsys.com>
>>> Tested-by: John Youn <johnyoun@synopsys.com>
>>
>> I suppose this is for v4.7 merge window ?
>>
> Technically - patch was started against 4.5, as there are no conflict changes around the file it fits for 4.6, 4.7.
> 
> 
> 

Hi Felipe,

Please queue for 4.6-rc.

Thanks,
John

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web