All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] usb: cdns3: gadget: Configure speed in udc_start
@ 2023-07-19  8:59 Ravi Gunasekaran
  2023-07-19 10:33 ` Marek Vasut
  2023-07-22  8:00 ` Roger Quadros
  0 siblings, 2 replies; 5+ messages in thread
From: Ravi Gunasekaran @ 2023-07-19  8:59 UTC (permalink / raw)
  To: marex, rogerq; +Cc: u-boot, r-gunasekaran

When one of the functions does not support super speed, the composite
driver forces the gadget to high speed. But the speed is never
configured in the cdns3 gadget driver. So configure the speed
in cdns3_gadget_udc_start just like in the kernel.

Signed-off-by: Ravi Gunasekaran <r-gunasekaran@ti.com>
---
 drivers/usb/cdns3/gadget.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/usb/cdns3/gadget.c b/drivers/usb/cdns3/gadget.c
index fcaeab9cc1..cae570cf59 100644
--- a/drivers/usb/cdns3/gadget.c
+++ b/drivers/usb/cdns3/gadget.c
@@ -82,6 +82,9 @@ static int __cdns3_gadget_ep_queue(struct usb_ep *ep,
 				   struct usb_request *request,
 				   gfp_t gfp_flags);
 
+static void cdns3_gadget_udc_set_speed(struct usb_gadget *gadget,
+				       enum usb_device_speed speed);
+
 /**
  * cdns3_set_register_bit - set bit in given register.
  * @ptr: address of device controller register to be read and changed
@@ -2341,6 +2344,7 @@ static int cdns3_gadget_udc_start(struct usb_gadget *gadget,
 
 	spin_lock_irqsave(&priv_dev->lock, flags);
 	priv_dev->gadget_driver = driver;
+	cdns3_gadget_udc_set_speed(gadget, gadget->max_speed);
 	cdns3_gadget_config(priv_dev);
 	spin_unlock_irqrestore(&priv_dev->lock, flags);
 	return 0;

base-commit: 76c61f29d63163d178b1584ecc9fc2c96c538ff0
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] usb: cdns3: gadget: Configure speed in udc_start
  2023-07-19  8:59 [PATCH] usb: cdns3: gadget: Configure speed in udc_start Ravi Gunasekaran
@ 2023-07-19 10:33 ` Marek Vasut
  2023-07-19 11:06   ` Ravi Gunasekaran
  2023-07-22  8:00 ` Roger Quadros
  1 sibling, 1 reply; 5+ messages in thread
From: Marek Vasut @ 2023-07-19 10:33 UTC (permalink / raw)
  To: Ravi Gunasekaran, rogerq; +Cc: u-boot

On 7/19/23 10:59, Ravi Gunasekaran wrote:
> When one of the functions does not support super speed, the composite
> driver forces the gadget to high speed. But the speed is never
> configured in the cdns3 gadget driver. So configure the speed
> in cdns3_gadget_udc_start just like in the kernel.
> 
> Signed-off-by: Ravi Gunasekaran <r-gunasekaran@ti.com>

Is this a patch picked from the kernel ?
Is there a matching kernel commit ID ?

> ---
>   drivers/usb/cdns3/gadget.c | 4 ++++
>   1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/usb/cdns3/gadget.c b/drivers/usb/cdns3/gadget.c
> index fcaeab9cc1..cae570cf59 100644
> --- a/drivers/usb/cdns3/gadget.c
> +++ b/drivers/usb/cdns3/gadget.c
> @@ -82,6 +82,9 @@ static int __cdns3_gadget_ep_queue(struct usb_ep *ep,
>   				   struct usb_request *request,
>   				   gfp_t gfp_flags);
>   
> +static void cdns3_gadget_udc_set_speed(struct usb_gadget *gadget,
> +				       enum usb_device_speed speed);
> +
>   /**
>    * cdns3_set_register_bit - set bit in given register.
>    * @ptr: address of device controller register to be read and changed
> @@ -2341,6 +2344,7 @@ static int cdns3_gadget_udc_start(struct usb_gadget *gadget,
>   
>   	spin_lock_irqsave(&priv_dev->lock, flags);
>   	priv_dev->gadget_driver = driver;
> +	cdns3_gadget_udc_set_speed(gadget, gadget->max_speed);
>   	cdns3_gadget_config(priv_dev);
>   	spin_unlock_irqrestore(&priv_dev->lock, flags);
>   	return 0;
> 
> base-commit: 76c61f29d63163d178b1584ecc9fc2c96c538ff0

Where did this ^ come from ?

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] usb: cdns3: gadget: Configure speed in udc_start
  2023-07-19 10:33 ` Marek Vasut
@ 2023-07-19 11:06   ` Ravi Gunasekaran
  2023-07-21  0:02     ` Marek Vasut
  0 siblings, 1 reply; 5+ messages in thread
From: Ravi Gunasekaran @ 2023-07-19 11:06 UTC (permalink / raw)
  To: Marek Vasut, rogerq; +Cc: u-boot, Ravi Gunasekaran



On 7/19/23 4:03 PM, Marek Vasut wrote:
> On 7/19/23 10:59, Ravi Gunasekaran wrote:
>> When one of the functions does not support super speed, the composite
>> driver forces the gadget to high speed. But the speed is never
>> configured in the cdns3 gadget driver. So configure the speed
>> in cdns3_gadget_udc_start just like in the kernel.
>>
>> Signed-off-by: Ravi Gunasekaran <r-gunasekaran@ti.com>
> 
> Is this a patch picked from the kernel ?
> Is there a matching kernel commit ID ?

The commit 4df50f89f5 ("usb: composite: force gadget to be USB2 for HS only function")
in u-boot, forces the gadget's max speed to high speed and had a mention in the commit
description that the gadget's udc_start would configure itself in USB 2.0. 

I checked the cdns3 gadget driver in kernel, and the cdns3_gadget_udc_start()
configures speed. So this is not a patch picked directly from the kernel. I used 
kernel code for reference.

> 
>> ---
>>   drivers/usb/cdns3/gadget.c | 4 ++++
>>   1 file changed, 4 insertions(+)
>>
>> diff --git a/drivers/usb/cdns3/gadget.c b/drivers/usb/cdns3/gadget.c
>> index fcaeab9cc1..cae570cf59 100644
>> --- a/drivers/usb/cdns3/gadget.c
>> +++ b/drivers/usb/cdns3/gadget.c
>> @@ -82,6 +82,9 @@ static int __cdns3_gadget_ep_queue(struct usb_ep *ep,
>>                      struct usb_request *request,
>>                      gfp_t gfp_flags);
>>   +static void cdns3_gadget_udc_set_speed(struct usb_gadget *gadget,
>> +                       enum usb_device_speed speed);
>> +
>>   /**
>>    * cdns3_set_register_bit - set bit in given register.
>>    * @ptr: address of device controller register to be read and changed
>> @@ -2341,6 +2344,7 @@ static int cdns3_gadget_udc_start(struct usb_gadget *gadget,
>>         spin_lock_irqsave(&priv_dev->lock, flags);
>>       priv_dev->gadget_driver = driver;
>> +    cdns3_gadget_udc_set_speed(gadget, gadget->max_speed);
>>       cdns3_gadget_config(priv_dev);
>>       spin_unlock_irqrestore(&priv_dev->lock, flags);
>>       return 0;
>>
>> base-commit: 76c61f29d63163d178b1584ecc9fc2c96c538ff0
> 
> Where did this ^ come from ?

I'm based on origin/next. Please let me know if I should base on origin/master?

-- 
Regards,
Ravi

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] usb: cdns3: gadget: Configure speed in udc_start
  2023-07-19 11:06   ` Ravi Gunasekaran
@ 2023-07-21  0:02     ` Marek Vasut
  0 siblings, 0 replies; 5+ messages in thread
From: Marek Vasut @ 2023-07-21  0:02 UTC (permalink / raw)
  To: Ravi Gunasekaran, rogerq; +Cc: u-boot

On 7/19/23 13:06, Ravi Gunasekaran wrote:
> 
> 
> On 7/19/23 4:03 PM, Marek Vasut wrote:
>> On 7/19/23 10:59, Ravi Gunasekaran wrote:
>>> When one of the functions does not support super speed, the composite
>>> driver forces the gadget to high speed. But the speed is never
>>> configured in the cdns3 gadget driver. So configure the speed
>>> in cdns3_gadget_udc_start just like in the kernel.
>>>
>>> Signed-off-by: Ravi Gunasekaran <r-gunasekaran@ti.com>
>>
>> Is this a patch picked from the kernel ?
>> Is there a matching kernel commit ID ?
> 
> The commit 4df50f89f5 ("usb: composite: force gadget to be USB2 for HS only function")
> in u-boot, forces the gadget's max speed to high speed and had a mention in the commit
> description that the gadget's udc_start would configure itself in USB 2.0.
> 
> I checked the cdns3 gadget driver in kernel, and the cdns3_gadget_udc_start()
> configures speed. So this is not a patch picked directly from the kernel. I used
> kernel code for reference.

Thanks for clarification.

Reviewed-by: Marek Vasut <marex@denx.de>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] usb: cdns3: gadget: Configure speed in udc_start
  2023-07-19  8:59 [PATCH] usb: cdns3: gadget: Configure speed in udc_start Ravi Gunasekaran
  2023-07-19 10:33 ` Marek Vasut
@ 2023-07-22  8:00 ` Roger Quadros
  1 sibling, 0 replies; 5+ messages in thread
From: Roger Quadros @ 2023-07-22  8:00 UTC (permalink / raw)
  To: Ravi Gunasekaran, marex; +Cc: u-boot



On 19/07/2023 11:59, Ravi Gunasekaran wrote:
> When one of the functions does not support super speed, the composite
> driver forces the gadget to high speed. But the speed is never
> configured in the cdns3 gadget driver. So configure the speed
> in cdns3_gadget_udc_start just like in the kernel.
> 
> Signed-off-by: Ravi Gunasekaran <r-gunasekaran@ti.com>

Reviewed-by: Roger Quadros <rogerq@kernel.org>

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-07-22  8:00 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-19  8:59 [PATCH] usb: cdns3: gadget: Configure speed in udc_start Ravi Gunasekaran
2023-07-19 10:33 ` Marek Vasut
2023-07-19 11:06   ` Ravi Gunasekaran
2023-07-21  0:02     ` Marek Vasut
2023-07-22  8:00 ` Roger Quadros

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.